My first problem:
writer.writerow(['Name,' 'Street,,' 'Address,,,'])
The above example returns "Name,Street,,Address,,,"
I need it to return Name,Street,,Address,,, without the quotation marks.
What should I do?
Ignacio's answer is absolutely right and is the one you want to use in practice.
But if you want to instruct csv to never use quotes, which is what the question seems to be literally asking, you can set the dialect paramater for quoting to csv.QUOTE_none. It would look like:
theWriter = csv.writer(open('thefile.csv', 'wb'),
delimeter = ',', quoting = csv.QUOTE_NONE)
Also, if you really want to micromanage what goes intot he file, you can skip the csv library and just write strings to the file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With