Created
February 27, 2014 20:26
-
-
Save blammothyst/9258808 to your computer and use it in GitHub Desktop.
Code from Learn Python the Hard Way(.org) ex 15
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
#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