Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sys import argv
- #Provides the user with two parameters to type before running the script.
- script, filename = argv
- # Opens whatever the user chooses that 'filename' represents.
- txt = open(filename)
- # replaces %r with the 'filename' This also places the 'filename' in quotes.
- print "Here's your file %r" % filename
- # This allows 'txt' which is 'open(filename)' to run
- print txt.read()
- print "I'll also ask you to type it again:"
- # Allows the user to type in the filename again
- file_again = raw_input("> ")
- # File_again will equal whatever the user chooses. file again will now equal txt again
- txt_again = open(file_again)
- # This line allows the txt_again code to run
- print txt_again.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement