jeudi 16 juin 2016

Encoding/Decoding Unicode and Writing CSV


I am trying to write words of non-latin based languages to a CSV and cannot get the words to be written in their proper form.

foreign='а также'
with open('C:\Users\Lance\Desktop\Programs\Database Builder\Russian Test.csv', 'wb') as outfile:
    outfile.write((foreign).encode('utf-8'))

The output of this code is:

а также

Thanks!


Aucun commentaire:

Enregistrer un commentaire