Skip to content Skip to sidebar Skip to footer

Writing Unicode Data In Csv

I know similar kind of question has been asked many times but seriously i have not been able to properly implement the csv writer which writes properly in csv (it shows garbage). I

Solution 1:

You are writing a file in UTF-8 format, but you don't indicate that into your csv file.

You should write the UTF-8 header at the beginning of the file. Add this:

ff = open('a.csv', 'w')
ff.write(codecs.BOM_UTF8)

And your csv file should open correctly after that with the program trying to read it.


Solution 2:

Opening the file with codecs.open should fix it.


Post a Comment for "Writing Unicode Data In Csv"