|

楼主 |
发表于 2020-8-23 15:10:36
|
显示全部楼层
你好,设置了编码utf-8打开依然报错
>>> a=open('/Users/apple/Documents/python/029文件:一个任务(课件+源代码)/课堂练习/record.txt',encoding='utf-8')
>>> a.read()
Traceback (most recent call last):
File "<pyshell#4>", line 1, in <module>
a.read()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbf in position 2: invalid start byte
>>> |
|