使用Python,如何遍历csv文件的每一行记录的每一个字段值

2025-03-22 01:09:22
推荐回答(1个)
回答1:

# coding:utf8
with open('file.csv','r') as f:
for t in f:
print  t.strip().split(',')
运行结果:
['1', 'a', 'b', 'c']
['2', 'd', 'e', 'f']
[Finished in 0.0s]