Python 3: Csv Utf-8 Encoding
I'm trying to write a CSV with non-ascii character using Python 3. import csv with open('sample.csv', 'w', newline='', encoding='utf-8') as csvfile: spamwriter = csv.writer(c
Solution 1:
You need to indicate to Excel that this is a UTF-8 file; it won't assume so automatically.
You do this by putting a Byte Order Mark (BOM) at the start of the file:
withopen('sample.csv', 'w', newline='', encoding='utf-8') as csvfile:
csvfile.write('\ufeff')
Post a Comment for "Python 3: Csv Utf-8 Encoding"