Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Print elements of a list to a .csv file

Tags:

python

string

csv

I am reading in a csv file and dealing with each line as a list. At the end, I'd like to reprint to a .csv file, but the lines aren't necessarily even. I obviously cannot just go "print row", since this will print it as a list. How can I print it in .csv format?

like image 405
ahhh Avatar asked Dec 28 '22 10:12

ahhh


1 Answers

Read manual, there's a CSV writer method (with example too). Don't print the data, store them and then write them into CSV file

http://docs.python.org/library/csv.html#csv.writer

like image 186
dwich Avatar answered Jan 08 '23 21:01

dwich