UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 99: invalid continuation byte


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

出現這種情況是由於讀取后進行轉碼出現錯誤,遇到了非法字符,解決的方法是檢測讀取的文件編碼,再進行下一步轉碼形式處理


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM