import urllib.requestimport urllib.parsepage = 1url = "http://www.qiushibaike.com/8hr/page/" + str(page)headers = {"User-Agent": "Mozilla/5.0 (Linux; Android 6.0;
Nexus 5 Build/MRA58N)"}request = urllib.request.Request(url, headers=headers)response = urllib.request.urlopen(request).read()html = response.decode("utf-8")print(html)运行后就报错误:UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 18194-18195: invalid continuation byte把'utf-8'改成'GBK'也不行一样报错,这个要怎么解决?
添加回答
举报
0/150
提交
取消