为了账号安全,请及时绑定邮箱和手机立即绑定

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

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

绝地无双 2019-02-17 10:15:36
from urllib.request import urlopen, urlcleanup, Requesturl = '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'” 这个有关,但是试了没有效果。 请帮忙解决一下~~~~谢谢!!
查看完整描述

3 回答

  • 3 回答
  • 0 关注
  • 921 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信