' UTF-8'编解码器不能解码位置11中的字节0x95:无效的起始字节

时间:2018-05-02 20:33:26

标签: python python-3.x encoding

我使用的是python 3.6,这是我的代码:

import csv

with open('data1.csv', newline='') as f:
    reader = csv.reader(f)
    for row in reader:
        print(row)

然后我明白了:

runfile('/Users/rong/Desktop/untitled0.py', wdir='/Users/rong/Desktop')
Traceback (most recent call last):

  File "<ipython-input-18-a9ca6afc41f8>", line 1, in <module>
    runfile('/Users/rong/Desktop/untitled0.py', wdir='/Users/rong/Desktop')

  File "/Users/rong/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 705, in runfile
    execfile(filename, namespace)

  File "/Users/rong/anaconda3/lib/python3.6/site-packages/spyder/utils/site/sitecustomize.py", line 102, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "/Users/rong/Desktop/untitled0.py", line 15, in <module>
    for row in reader:

  File "/Users/rong/anaconda3/lib/python3.6/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)

UnicodeDecodeError: 'utf-8' codec can't decode byte 0x95 in position 11: invalid start byte

我不确定我应该使用哪种编码用于0x95,任何人都有帮助吗?

0 个答案:

没有答案