Skip to content

Instantly share code, notes, and snippets.

@melodykramer
Created March 23, 2014 15:58
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 melodykramer/9725109 to your computer and use it in GitHub Desktop.
Save melodykramer/9725109 to your computer and use it in GitHub Desktop.
Write mode says if it doesn't exist, create it. If it does, write over it.
If that's a problem, use append mode. Append mode says "if your file exists, great. if it doesn't exist, then it will add it to the end -- which is the beginning of a new file"
@melodykramer
Copy link
Author

with open ("states.txt", "r") as
states_file:
states = states_file.read()

print states

states_file is a file object that is opening states.txt in read-only mode
states_file is a variable
strings are a type of object.

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