ahhh ahhh - 2 years ago 92
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?

Answer Source

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

print ",".join(row)
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download