Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #http://learnpythonthehardway.org/book/ex15.html
- #c:python33 python ex15.py arg_filename
- #keep in mind the file name has to be exact... under windows what you see
- #is not always what you get
- #there are instances where you will want to run dir
- #at the windows command line to make sure the file you want is really there
- from sys import argv
- script, filename = argv #this is going to call the txt file
- txt = open(filename)
- print ("Here's your file {}".format(filename))
- print (txt.read())
- #close (txt.read()) # this doesn't work
- txt.close()
- again = input ("filename again please:")
- txt_again = open(again)
- print (txt_again.read())
- txt_again.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement