我有15列的csv文件。给定以下代码,什么是最好的pythonic方法来存档它?
with open('file.csv') as f:
for lname, fname, age, phone, email, company, company_no, blah, blah in csv.reader(f):
pass
我试图解开序列,但有15列看起来很丑陋。我试过这样:
with open('file.csv') as f:
for row in csv.reader(f):
fname = row[0]
lname = row[1]
...
但这不是我想要的。我怎么能把这个干净?
呼唤远方
相关分类