Rumah > Soal Jawab > teks badan
迷茫2017-04-18 10:02:33
"User-Agent": "Mozilla/5.0 (windows 6.0)"
python3
import urllib.request
url = "http://www.qiushibaike.com/8hr/page/1"
headers = {
#"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)"
"User-Agent": "Mozilla/5.0 (windows 6.0)"
}
request = urllib.request.Request(url, headers=headers)
response = urllib.request.urlopen(request)
c = response.read()
h = c.decode('utf-8')
print(h)
伊谢尔伦2017-04-18 10:02:33
python3 tidak memerlukan transkoding