这是我的代码
f= open('test1.txt','r')
todo = open('fb12.txt','w')
reader = csv.reader(f,delimiter=' ', quotechar='|')
writer = csv.writer(todo)
for row in reader:
writer.writerows(row)
我希望输出与它应该看起来像
的输入相同"DDD","3D Systems Corporation","23.47","1100203190","n/a","Technology","Computer Software:
etc.
相反,我得到了这个:
"""",D,D,D,"""",",","""",3,D
S,y,s,t,e,m,s
C,o,r,p,o,r,a,t,i,o,n,"""",",","""",2,3,.,4,7,"""",",","""",1,1,0
S,o,f,t,w,a,r,e,:
P,r,e,p,a,c,k,a,g,e,d
HELP!
答案 0 :(得分:2)
你有一个太多的迭代层: - )
将for循环替换为:
writer.writerows(reader)
或者将 writerows 更改为 writerow :
for row in reader:
writer.writerow(row)