我正在将我的数据输入.csv文件,我这样做:
my_list = ['ip5v', 'ip7.5', 'ip10v', 'ip12.5v', 'ip15v', 'ip17.5v', 'ip20v']
a = ipen('csv_fi.csv', 'a')
b = csv.writer(a)
b.writerow(('SerialNo','ip5v', 'ip7.5', 'ip10v', 'ip12.5v', 'ip15v', 'ip17.5v', 'ip20v'))
然后我的.csv doc有正确的列:
SerialNo,ip5v, ip7.5v, ip10v, ip12.5v, ip15v, ip17.5v, ip20v
我试图让标题更通用,并且做了:
b.writerow(('SerialNo', my_list))
并获得Header为:
SerialNo,"['ip5v', 'ip7.5v', 'ip10v', 'ip12.5v', 'ip15v', 'ip17.5v', 'ip20v']"
我哪里出错了,我应该如何编辑它以使通用像:
SerialNo,ip5v, ip7.5v, ip10v, ip12.5v, ip15v, ip17.5v, ip20v