with open('paper.csv','rb') as f:
f_csv = csv.reader(f)
headers = next(f_csv)
print(headers)
for row in f_csv:
print(row)
问题原因: paper.csv只是一个文本文件,并非二进制文件
问题解决: 改为如下
with open('paper.csv','r', encoding='utf-8') as f:
f_csv = csv.reader(f)
headers = next(f_csv)
print(headers)
for row in f_csv:
print(row)
用’r’或者’rt’