代码语言:javascript复制
with open('filename','r') as csv_f:
reader = csv.reader(csv_f)
fieldnames = next(reader)
csv_reader = csv.DictReader(f,fieldnames=fieldnames)
for row in csv_reader:
d = {}
for k, v in row.items():
d[k] = v
print(d)