Skip to content

Instantly share code, notes, and snippets.

@blammothyst
Created February 27, 2014 20:26
Show Gist options
  • Save blammothyst/9258808 to your computer and use it in GitHub Desktop.
Save blammothyst/9258808 to your computer and use it in GitHub Desktop.
Code from Learn Python the Hard Way(.org) ex 15
#says what we are opening from where
from sys import argv
#here's what the two things we are importing will be
script, filename = argv
#variable txt means open that file
txt= open(filename)
#uses modulus to call out the filename
print "Here's your file %r:" % filename
#prints the file
print txt.read()
#prints a prompt
print "Type the filename again:"
file_again = raw_input("> ")
txt_again = open(file_again)
print txt_again.read()
print "which file you want to close?"
file_again = raw_input("? ")
file.close(file_again)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment