【发布时间】:2014-07-03 15:09:02
【问题描述】:
我的 CSV 写入语句无法正常工作;
我有一个包含字符串的列表,每个字符串都需要写入 csv 中自己的行;
mylist = ['this is the first line','this is the second line'........]
with open("output.csv", "wb") as f:
writer = csv.writer(f)
writer.writerows(mylist)
问题是,我的输出在某处搞砸了,看起来像这样;
't,h,i,s, i,s, t,h,e, f,i,r,s,t, l,i,n,e,'.... etc.
我需要;
'this is the first line'
'this is the second line'
【问题讨论】: