Skip to content

Instantly share code, notes, and snippets.

@andrew-morris
Created February 16, 2016 21:27
Show Gist options
  • Save andrew-morris/8586439e48d5a6bde651 to your computer and use it in GitHub Desktop.
Save andrew-morris/8586439e48d5a6bde651 to your computer and use it in GitHub Desktop.
Python file IO
# open a handle to the file, with 'read permissions'
f = open("/etc/passwd", "r")
# use the file handle to store the contents of the file into the "contents" object
contents = f.read()
# close the file handle
f.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment