我試圖打開相同的所需網(wǎng)頁(由用戶)選定的次數(shù),但我似乎無法讓它工作。#Imports modulesimport requestsimport time#Assigning variables to stringsimport urllib.requesturl = "https://r6tab.com/bd6a3f35-5060-499a-8645-369664aae1d9"# Open the URL as Browser, not as python urllibhow = 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>>> 修復了錯誤,但網(wǎng)頁上的瀏覽量沒有計算在內(nèi)
Python程序查看用戶選擇的同一網(wǎng)頁的次數(shù)
函數(shù)式編程
2021-08-05 18:06:59