Created
September 13, 2016 21:56
-
-
Save hackjutsu/5b3158ee02c9db4117f98ec8e77d6e36 to your computer and use it in GitHub Desktop.
Reading a file in Python
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 the file with read only permit | |
f = open('myTextFile.txt', "r") | |
## use readlines to read all lines in the file | |
## The variable "lines" is a list containing all lines | |
lines = f.readlines() | |
## close the file after reading the lines. | |
f.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment