blechinger

ex15.py

Nov 8th, 2014
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.53 KB | None | 0 0
  1. from sys import argv
  2. # This gives us script and filename as variables to use
  3. #     which are given when the script is called.
  4. script, filename = argv
  5.  
  6. # This assigns open(filename) to the function txt.
  7. txt = open(filename)
  8.  
  9. # This prints our line and calls to print the raw data
  10. #     given from filename.
  11. print "Here's your file %r:" % filename
  12. # This tells txt to read (print) the file.
  13. print txt.read()
  14.  
  15. # Notes
  16. #
  17. #    I'm not sure why I can't replace txt.read() with
  18. #    open(filename).read() and have it work the same way...
Add Comment
Please, Sign In to add comment