Code that gives the error:
f = csv.reader(open(csvroot, 'r',encoding='utf-8'))
for i in f:
print(i)
Solution for UnicodeDecodeError : Check the format of the file which is used for the encoding
import chardet
f = open(full_csvroot, 'rb')
data = f.read()
print(chardet.detect(data))
# Outcome:
# {'encoding': 'GB2312', 'confidence': 0.99, 'language': 'Chinese'}
Check Out this code too:
f = csv.reader(open(csvroot, 'r',encoding='GB2312'))
for i in f:
print(i)
Also Read | [Solved]Vue Project Error: Error from chokidar