Python 官方文档:入门教程 => 点击学习
python读文件时报错: Traceback (most recent call last): File "xxx.py", line 3, in for line in input_fi
python读文件时报错:
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'
例如:
with open('xxxx.csv', 'r', errors='ignore') as input_file:
with open('xxxx.csv', 'r', encoding='utf-8', errors='ignore') as f:
来源地址:https://blog.csdn.net/qq_39441603/article/details/130494614
--结束END--
本文标题: 【python】报错UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte in position : illegal multibyte
本文链接: https://lsjlt.com/news/422030.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0