看来我不明白csv.write是如何工作的。任何提示将非常有帮助。当我写的时候:x=['1468853914','2016-07-18 12:04:56.2 UTC', '0','970.157']import csvmyFile = 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
1 回答
慕尼黑的夜晚无繁华
TA贡献1864条经验 获得超6个赞
您需要使用 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)
添加回答
举报
0/150
提交
取消