Skip to content

Instantly share code, notes, and snippets.

@guestl
Last active February 25, 2017 11:26
Show Gist options
  • Select an option

  • Save guestl/9efa5c6e60404fb73b1e7b86e785f084 to your computer and use it in GitHub Desktop.

Select an option

Save guestl/9efa5c6e60404fb73b1e7b86e785f084 to your computer and use it in GitHub Desktop.
Load file in binary mode with lambda function
with codecs.open(filename, "rb", "utf-8") as file:
for ch in iter(lambda: file.read(1), ""):
print(ch)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment