How write a string with quotes to a spreadsheet file (CSV) in Python

1 Answer

0 votes
import csv

csv = open('d:\data.csv', "w")

s = "\"test\""

s = s.replace("\"", "\"\"")

s = "\"" + s + "\""

csv.write(s)

'''
run:

data.csv
--------
"test"

'''

 



answered Jun 29, 2018 by avibootz

Related questions

1 answer 255 views
1 answer 231 views
1 answer 236 views
1 answer 191 views
1 answer 181 views
...