我只是想让Python查看网站搜索结果的所有网页:
remainder = "latter_part_of_url"
page = '?s=0'
urlstring = 'https://domain/search/' + str(page) + str(remainder)
pagenumber = str(page)+120
for i in range(120, 100000, 120):
# I am trying to increment by 120, how do I do that?
print(urlstring)
答案 0 :(得分:0)
这不是一件简单的事情:
for new_page_num in range(int(page)+120, 100000, 120):
urlstring = 'https://domain/search/' + str(new_page_num) + str(remainder)
我会使用一些字符串格式而不是+。