0
輸入文件:chars.csv:獲取的UnicodeDecodeError同時訪問CSV文件
4,,x,,2,,9.012,2,,,,
6,,y,,2,,12.01,±4,,,,
7,,z,,2,,14.01,_3,,,,
當我嘗試分析這個文件,我甚至指定UTF-8編碼後得到這個錯誤。
>>> f=open('chars.csv',encoding='utf-8')
>>> f.read()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.2/codecs.py", line 300, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb1 in position 36: invalid start byte
如何更正此錯誤?
版本:3.2.3的Python