0
CSV writing in Python
I wanted to write somedata in csv, the code is as follows: import csv row = ['2', 'Marie', 'California'] file = open('D://file.csv','w') with file: writer = csv.writer(file) writer.writerows(row) file.close() # End of code The o/p I expected in file.csv is 2, Marie, California but instead, I m getting: 2 M,a,r,i,e C,a,l,i,f,o,r,n,i,a Can somebody help me?
1 Resposta
+ 1
Thanks Jan, it worked.