Created
May 22, 2021 09:33
-
-
Save popcmp/7074ac9e5822f42b0a9d35a9aa414788 to your computer and use it in GitHub Desktop.
Read write utf-8 in Python3 best way
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
| 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