py请求网页出现codec can't decode byte 0x8b

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'” 这个有关,但是试了没有效果。

请帮忙解决一下~~~~
谢谢!!

绝地无双
浏览 945回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python