Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python URL库查询_Python - Fatal编程技术网

Python URL库查询

Python URL库查询,python,Python,我正在考虑如何扩展这个脚本,让它反复下载接下来的20个文件,但我被卡住了。有什么提示吗 import urllib fhand = urllib.urlopen('http://ecorp.azcc.gov/Search/Details?Request.Term=1&Request.IsActive=True&Request.Type=StartsWith&Request.Category=Entity&Request.SearchMethod=BusinessE

我正在考虑如何扩展这个脚本,让它反复下载接下来的20个文件,但我被卡住了。有什么提示吗

import urllib
fhand = urllib.urlopen('http://ecorp.azcc.gov/Search/Details?Request.Term=1&Request.IsActive=True&Request.Type=StartsWith&Request.Category=Entity&Request.SearchMethod=BusinessEntity&Request.CurrentPageIndex=0&Request.EntityType=All&Request.PageDirection=Next')
for line in fhand:
    print line #.strip()

您的URL中似乎有一个
CurrentPageIndex=0
参数,您可以使用该参数移动到下一页

for i in range(0, 20):
    # Put the full URL below, I've put ... to shorten it
    url = 'http://ecorp.azcc.gov/...CurrentPageIndex={}...'.format(i)
    fhand = urllib.urlopen(url)
    # do something with fhand