Skip to content

Instantly share code, notes, and snippets.

@liuxd
Created February 12, 2020 02:56
Show Gist options
  • Save liuxd/ac29221ed34bc741a8972dedc4960a22 to your computer and use it in GitHub Desktop.
Save liuxd/ac29221ed34bc741a8972dedc4960a22 to your computer and use it in GitHub Desktop.
[Ignore BOM while reading a file with Python 3]
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