I'm attempting to write a list to a csv, however when I do so I get wrapper quotes around my field values:
number1,number2
"1234,2345"
"1235.7890"
"2345.5687"
Using this code:
with open('C:\\temp\\test.csv', 'wb') as out_file:
... csv_writer = csv.writer(out_file, delimiter=',')
... csv_writer.writerow(('number1','number2'))
... for f in myList:
... csv_writer.writerow(f)
After further research, I found that you can remove the writing of quotes by using:
quotechar='', quoting=csv.QUOTE_NONE**
When I apply this to my code I get this error:
Traceback (most recent call last): File "", line4, in Error: need to escape, but no escapechar set
with open('C:\\temp\\test.csv', 'wb') as out_file:
... csv_writer = csv.writer(out_file, delimiter=',',quotechar='', quoting=csv.QUOTE_NONE)csv_writer.writerow(('number1','number2'))
... for f in myList:
... csv_writer.writerow(f)
How do I remove these quotes?
Edit
myList looks like:
[['1234,2345'], ['1235,7890'], ['2345,5687']]