ahhh ahhh - 11 months ago 31
Python Question

Print elements of a list to a .csv file

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?


Assuming that "row" contains a list of strings, you could try using

print ",".join(row)