我正在尝试使用requests.get请求多个网址。这是我开始的
for number in range(1,10):
page =requests.get('http://google.com/page'+str(number),'http://yahoo.com/page'+str(number))
但我得到的是一个错误 TypeError:get()只取1个参数(给定2个)
我也试过这个
url=['','http://google.com/page','http://yahoo.com/page']
for number in range(1,10):
page = requests.get(url[number]+str(number))
这给了我
IndexError: list index out of range
答案 0 :(得分:7)
urls = ['http://google.com/page','http://yahoo.com/page']
for url in urls:
for number in range(1,10):
page = requests.get(url+str(number))