문제

i am trying to request multi urls using requests.get this is what i started with

for number in range(1,10):
    page =requests.get('http://google.com/page'+str(number),'http://yahoo.com/page'+str(number))

but what i get is an error TypeError: get() takes exactly 1 argument (2 given)

i have also tried this

url=['','http://google.com/page','http://yahoo.com/page']

for number in range(1,10):
    page = requests.get(url[number]+str(number))

this gives me

IndexError: list index out of range
도움이 되었습니까?

해결책

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))
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top