1、UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xad in position
解决办法:加入编码 encoding='utf-8’
2、python读取csv文件是报错_csv.Error: iterator should return strings, not bytes (did you open the file in text
问题分析:因为此csv文件是一个文本文件,并非二进制文件。
解决办法:将rb换成r或者rt
import csv
csvfile = open('D:\\Python01\\user_info.csv','rt',encoding='utf-8')
reader = csv.reader(csvfile)
for row in reader:
print(row)