Skip to content

Instantly share code, notes, and snippets.

@hackjutsu
Created September 13, 2016 21:56
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 hackjutsu/5b3158ee02c9db4117f98ec8e77d6e36 to your computer and use it in GitHub Desktop.
Save hackjutsu/5b3158ee02c9db4117f98ec8e77d6e36 to your computer and use it in GitHub Desktop.
Reading a file in Python
## 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