Created
February 12, 2020 02:56
-
-
Save liuxd/ac29221ed34bc741a8972dedc4960a22 to your computer and use it in GitHub Desktop.
[Ignore BOM while reading a file with Python 3]
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
f = open('file', mode='r', encoding='utf-8-sig') | |
f.read() | |
# set encoding='utf-8-sig' is the key point. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment