Skip to content

Instantly share code, notes, and snippets.

@dogweather
Last active December 29, 2015 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dogweather/7684045 to your computer and use it in GitHub Desktop.
Save dogweather/7684045 to your computer and use it in GitHub Desktop.
Read a text file into a string and close the file.
with open('file.txt') as f: contents = f.read()
@dogweather
Copy link
Author

Python 2.6+

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment