UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 72
with open('yy.csv', 'r') as f:
rows = csv.reader(f)
rows = list(rows)
for row in rows:
print(row)
以上代码发生错报
原因可能是csv文件编码问题
解决:
with open('yy.csv', 'r', encoding='utf-8', errors='ignore') as f:
rows = csv.reader(f)
rows = list(rows)
for row in rows:
print(row)
指定编码,忽略编码问题,不忽略,如果遇到无法编码的特殊字符,依旧会报错