I have a file example.csv with the contents
1,\"A towel,\",1.0
42,\" it says, \",2.0
1337,is about the most ,-1
0,massively useful thing ,123
-2
First you need to import csv
For eg:
import csv
with open('eggs.csv', 'wb') as csvfile:
spamwriter = csv.writer(csvfile, delimiter=' ',
quotechar='|', quoting=csv.QUOTE_MINIMAL)
spamwriter.writerow(['Spam'] * 5 + ['Baked Beans'])
spamwriter.writerow(['Spam', 'Lovely Spam', 'Wonderful Spam'])