爬虫页面转码报错解决UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xd0 in position 10433: illegal multibyte sequence

python抓取网页后用decode解码,报错信息如下: UnicodeDecodeError:’gbk’ codec can’t decode byte 0xfb in position 1011: illegal multibyte sequence 推测是网页数据中有错误的字符无法解码,decode有参数errors,设置一下OK ignore’)

response=XXXX.content.decode('gbk',errors = 'ignore')

 

说点什么

avatar
  Subscribe  
提醒