Created
August 19, 2017 10:40
-
-
Save tobywf/5be49947253abf1c0cd56d27568d4ad7 to your computer and use it in GitHub Desktop.
Generate a UTF-8 comma separated value (CSV) file that Excel reads reliably (Legacy Python 2, shame)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
from __future__ import unicode_literals | |
from backports import csv | |
from io import open | |
with open('test.csv', 'w', encoding='utf-8-sig', newline='') as fp: | |
writer = csv.writer(fp) | |
writer.writerow(['Row', 'Emoji']) | |
for i, emoji in enumerate(['π ', 'π€', 'π']): | |
writer.writerow([str(i), emoji]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment