错误类型:UnicodeDecodeError: 'gbk' codec can't decode byte 0xd0 in position 15670: illegal multibyte sequence

原代码:

text =response.content.decode('gbk') 

错误提示:

text =response.content.decode('gbk')
UnicodeDecodeError: 'gbk' codec can't decode byte 0xd0 in position 15670: illegal multibyte sequence

出现这种该问题就给decode加一个ignore参数,修改后如下:

text =response.content.decode('gbk', "ignore")

  

就不会报错了。

posted @ 2020-03-12 01:05  胡辣汤王子  阅读(478)  评论(0编辑  收藏  举报