爬虫 -- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position 301: unexpected end of data


 errors参数有3个值:strict,  ignore,  replace

 

html.decode("utf-8"),这种形式有时会报错,那么修改为下面形式,将decode函数的第二个参数errors设置为ignore,默认是strict
html.decode("utf-8",'ignore')



免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM