似乎我不了解csv.write的工作方式。任何提示都将非常有帮助。
我写的时候:
x=['1468853914','2016-07-18 12:04:56.2 UTC', '0','970.157']
import csv
myFile = open('csvexample4.csv', 'w')
writer = csv.writer(myFile, delimiter=',')
writer.writerows(x)
我希望得到一个以逗号分隔的csv文件,如下所示
'1468853914','2016-07-18 12:04:56.2 UTC', '0','970.157'
但我知道
1,4,6,8,8,5,3,9,1,4
2,0,1,6,-,0,7,-,1,8, ,1,2,:,0,4,:,5,6,.,2, ,U,T,C
0
9,7,0,.,1,5,7
答案 0 :(得分:1)
您需要使用writerow
例如:
x=['1468853914','2016-07-18 12:04:56.2 UTC', '0','970.157']
import csv
myFile = open(filename, 'w')
writer = csv.writer(myFile, delimiter=',')
writer.writerow(x)