Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12201

Write CSV file with double quotes for particular column not working

$
0
0

I'm trying to write a CSV file using Python's csv writer.

One of the column values is enclosed in "" [double quotes] e.g.: 'col1''col2'"test". When I open the file in Wordpad, the word test is expected as "test" but the actual result is """test""".

Can someone please guide for this issue?

Sample snippet of my try out:

csvReader = csv.reader(iInputFile)writer = csv.writer(open('one_1.csv', 'wb'), delimiter=',', lineterminator='\r\n')for row in csvReader:     rawRow = []     rawRow.append('31-7-2014') #Appending Date     rawRow.append(row[0])   #Appending data     rawRow.append('\"'+'test'+'\"')      writer.writerow(rawRow)

Viewing all articles
Browse latest Browse all 12201

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>