0

I have a text file that I obtained by converting a dataframe using csv module in Python as follows:

df.to_csv(r'listfinal.txt', header=None, index=None, sep=' ', mode='a')

The text file has double quotes around many entries, i.e,

Circles "Post Malone"
"You Know You Like It" "DJ Snake"
"Future Nostalgia" "Dua Lipa"

I wish to remove all such double quotes from anywhere on this file. What do I change in the initial conversion df.to_csv?

AmanArora
  • 2,379
  • 6
  • 19
  • 22

1 Answers1

0

Have you tried:

df.to_csv(r'listfinal.txt', header=None, index=None, sep=' ', mode='a', quoting=csv.QUOTE_NONE)

you could also use csv.QUOTE_MINIMAL instead

Gorlomi
  • 515
  • 2
  • 11