Traceback (most recent call last): File "/Users/c2apple/PycharmProjects/easyToPython/fileMethod.py", line 94, in <module> line=fp.readline() File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/codecs.py", line 321, in decode (result, consumed) = self._buffer_decode(data, self.errors, final) UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xef in position 99: invalid continuation byte
出现这种情况是由于读取后进行转码出现错误,遇到了非法字符,解决的方法是检测读取的文件编码,再进行下一步转码形式处理
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 99: invalid continuation byte
时间: 2024-11-01 13:57:00