from urllib.request import urlopen, urlcleanup, Request
url = 'http://tech.qq.com/a/20181210...'
request = Request(url)
response = urlopen(request)
content = response.read().decode('gb2312')
urlcleanup()
出现:
UnicodeDecodeError: 'gb2312' codec can't decode byte 0x8b in position 1: illegal multibyte sequence
这个问题怎么解决呢!?网上我看了很多资料,都是和请求头
“'Accept-Encoding': 'gzip, deflate'” 这个有关,但是试了没有效果。
请帮忙解决一下~~~~
谢谢!!
相关分类