Skip to content

Instantly share code, notes, and snippets.

@tobywf
Created August 19, 2017 10:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tobywf/3773a7dc896f780c2216c8f8afbe62fc to your computer and use it in GitHub Desktop.
Save tobywf/3773a7dc896f780c2216c8f8afbe62fc to your computer and use it in GitHub Desktop.
Generate a UTF-8 comma separated value (CSV) file that Excel reads reliably (Python 3, obvs)
import csv
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])
@alucard001
Copy link

alucard001 commented Jan 24, 2024

That just simply doesn't work at all. This is what I got when I execute your code in AWS Python 3.12.1 Lambda.
image

Update: This piece of code actually works. It just doesn't work correctly when you put it in Python AWS Lambda.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment