SHOW:
|
|
- or go back to the newest paste.
| 1 | from sys import argv | |
| 2 | ||
| 3 | script, filename = argv | |
| 4 | ||
| 5 | #It isn't really going to erase anything | |
| 6 | print "We're going to erase %r." % filename | |
| 7 | print "If you don't want that, hit CTRL-C (^C)." | |
| 8 | print "If you do want that, hit RETURN." | |
| 9 | ||
| 10 | raw_input("?")
| |
| 11 | ||
| 12 | print "Opening the file..." | |
| 13 | target = open(filename, 'w') | |
| 14 | - | print "Truncating the file. Goodbye!" |
| 14 | + | |
| 15 | - | target.truncate() |
| 15 | + | #print "Truncating the file. Goodbye!" |
| 16 | #target.truncate() | |
| 17 | ||
| 18 | print "Now I'm going to ask you for three lines." | |
| 19 | - | line1 = raw_input("Line1: ")
|
| 19 | + | |
| 20 | - | line2 = raw_input("Line2: ")
|
| 20 | + | line1 = raw_input("Line1: \n")
|
| 21 | - | line3 = raw_input("Line3: ")
|
| 21 | + | line2 = raw_input("Line2: \n")
|
| 22 | line3 = raw_input("Line3: \n")
| |
| 23 | ||
| 24 | print "I'm going to write these to the file." | |
| 25 | - | target.write(line1) |
| 25 | + | |
| 26 | - | target.write("\n")
|
| 26 | + | target.write("%r , %r , %r") % (line1, line2, line3)
|
| 27 | - | target.write(line2) |
| 27 | + | |
| 28 | - | target.write("\n")
|
| 28 | + | |
| 29 | - | target.write(line3) |
| 29 | + |