I have a python list similar to this:
my_list = ["hello", "bye", "good morning", "good evening", , "'yes", "''no'"]
Note that there may be some weird combination of quotation marks within a string.
I want to output it into a text file, however the quotation marks get lost in the process.
My code:
with open('/foo/bar.txt', 'w') as writefile:
writefile.write('\n'.join(my_list))
My text file looks like this
hello
bye
good morning
...
I want it to look like this:
"hello"
"bye"
"good morning"
...