write chinese words in csv file using python2.7
Question: I am trying to write Chinese words like 花花公子昊天鞋类专营店 in a CSV file in python,
but not able to do it. I tried solution given here("[issues with writing
Chinese to csv file in
Python](http://stackoverflow.com/questions/29442448/issues-with-writing-
chinese-to-csv-file-in-python)"). Any help will be appreciated.


Answer: The module `unicodecsv` helps with that (you can install that with **pip**):

    
    
    import unicodecsv
    w = unicodecsv.writer(open("test.csv", "w"))
    w.writerow((u"花花公子昊天鞋类专营店", 78.10))
    del w
    

The resulting csv file opens succesfully in OpenOffice.

You can also read it back in Python:

    
    
    r = unicodecsv.reader(open("test.csv", "rb"))
    for row in r:
        print row[0], row[1]
    

And when run, it should print:

    
    
    (user@motoom) ~/Prj/python $ python chinesecsv.py
    
    花花公子昊天鞋类专营店 78.1
    

