我试图打开相同的所需网页(由用户)选定的次数,但我似乎无法让它工作。
#Imports modules
import requests
import time
#Assigning variables to strings
import urllib.request
url = "https://r6tab.com/bd6a3f35-5060-499a-8645-369664aae1d9"
# Open the URL as Browser, not as python urllib
how = input("Enter how many views you want!")
for counter in range (0,how):
page=urllib.request.Request(url,headers={'User-Agent': 'Mozilla/5.0'})
infile=urllib.request.urlopen(page).read()
Traceback (most recent call last):
File "C:/Users/lauchlan/Desktop/sss.py", line 14, in <module>
for counter in range (0,how):
TypeError: 'str' object cannot be interpreted as an integer
>>>
修复了错误,但网页上的浏览量没有计算在内
哈士奇WWW
相关分类