python读文件时报错:文章来源:https://www.toymoban.com/news/detail-744322.html
Traceback (most recent call last):
File "xxx.py", line 3, in <module>
for line in input_file:
UnicodeDecodeError: 'gbk' codec can't decode byte 0x91 in position 5458: illegal multibyte sequence
解决方法(不保证内容完整读取):
加入errors='ignore'
例如:文章来源地址https://www.toymoban.com/news/detail-744322.html
with open('xxxx.csv', 'r', errors='ignore') as input_file:
with open('xxxx.csv', 'r', encoding='utf-8', errors='ignore') as f:
到了这里,关于【python】报错UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte in position : illegal multibyte的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!