PDA

View Full Version : Python CSV



zjimward
15th May 2004, 01:34 AM
I've written the following:

reader = csv.reader(file("vault.csv"))
writer = csv.writer(file("export.csv", "w"))

for row in reader:

writer.writerow(row)

It works fine, but I want double quotes around all of the output in the export.csv file. How do I do this??

Thanks.

zjimward
15th May 2004, 05:22 PM
I figured it out. I rewrote the code as follows:

reader = csv.reader(file("vault.csv"))
writer = csv.writer(file("export.csv", "w"), quoting=1)

for row in reader:

writer.writerow(row)