fork download
  1. from sys import argv
  2.  
  3. script,filename = agrv
  4.  
  5. print " were going to erase %r." % filename
  6. print " if you dont want that, hit ctrl-c ^C. "
  7. print " if you do want that, hit return."
  8.  
  9. raw_input("?")
  10.  
  11. print "opening the file.."
  12. target = open (filename, 'w')
  13.  
  14. print " truncating the file. good bye "
  15. target.truncate()
  16.  
  17. print " now im going to ask you for three lines"
  18.  
  19. line1 = raw_input ("line 1: " )
  20. line2 = raw_input ("line 2: " )
  21. line3 = raw_input ("line 3: " )
  22.  
  23. print " im going to write to file"
  24.  
  25. target.write(line1)
  26. target.write("\n")
  27. target.write(line2)
  28. target.write("\n")
  29. target.write(line3)
  30. target.write("\n")
  31.  
  32. print " and finaly we close it"
  33. target.close()
  34.  
  35.  
  36.  
  37.  
Runtime error #stdin #stdout 0.02s 4672KB
stdin
Standard input is empty
stdout
Standard output is empty