Python URL库查询
我正在考虑如何扩展这个脚本,让它反复下载接下来的20个文件,但我被卡住了。有什么提示吗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
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