Created
February 16, 2016 21:27
-
-
Save andrew-morris/8586439e48d5a6bde651 to your computer and use it in GitHub Desktop.
Python file IO
This file contains 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
# 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