输入文件路径后报错
来源:2-1 实现新闻管理系统正文内容的存储功能
MaxLu
2020-07-15 19:00:19
输入文件路径后报错:报错信息如下
Traceback (most recent call last):
File "/Library/WebServer/Documents/python/code/imooc/imooc_databases/my_mongo_db/vega_2/app.py", line 58, in <module>
content = file.read()
File "/Users/luweilei/opt/anaconda3/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x96 in position 11: invalid start byte
1回答
好帮手慕笑蓉
2020-07-16
同学,你好。此错误是因为以utf-8的格式打开文件后,无法识别文件中的一些编码,可将相应路径下的文件用txt格式,并选择utf-8的格式保存,如:
之后再次尝试。
如果解决了你的疑惑,请采纳,祝学习愉快~
相似问题