Skip to content

Instantly share code, notes, and snippets.

@popcmp
Created May 22, 2021 09:33
Show Gist options
  • Select an option

  • Save popcmp/7074ac9e5822f42b0a9d35a9aa414788 to your computer and use it in GitHub Desktop.

Select an option

Save popcmp/7074ac9e5822f42b0a9d35a9aa414788 to your computer and use it in GitHub Desktop.
Read write utf-8 in Python3 best way
with open(filename, 'r', encoding='utf8') as f:
text = f.read()
# process Unicode text
with open(filename, 'w', encoding='utf8') as f:
f.write(text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment