Guest User

Untitled

a guest
Jan 22nd, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. # LPTHW - Exercise 17
  2.  
  3. from sys import argv
  4. from os.path import exists
  5.  
  6. script, from_file, to_file = argv
  7.  
  8. print "Copying from %s to %s" % (from_file, to_file)
  9.  
  10. # we could do these two on one line too, how?
  11. input = open(from_file)
  12. indata = input.read()
  13.  
  14. print "The input file is %d bytes long" % len(indata)
  15.  
  16. print "Does the output file exist? %r" % exists(to_file)
  17. print "Ready, hit RETUEN to continue, CTRL-C to abort."
  18. raw_input()
  19.  
  20. output = open(to_file, 'w')
  21. output.write(indata)
  22.  
  23. print "Alright, all done."
  24.  
  25. #output.close()
  26. input.close()
Add Comment
Please, Sign In to add comment