Я использую 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, кто-нибудь поможет, пожалуйста?