-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex16_rnw2.py
More file actions
26 lines (21 loc) · 765 Bytes
/
ex16_rnw2.py
File metadata and controls
26 lines (21 loc) · 765 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
from sys import argv
script , filename = argv
print "This Program wil erase all contennt of selected file %r"%filename
print "To Continue press ENTER and to Quit press "
raw_input("?")
print "opening file"
target=open(filename, 'w')
target.truncate()
print "The Content of %r file deleted"%filename
print "Now this part of program will attempt to rewrite the contents back into the file"
print "To Continue press ENTER and to Quit press "
raw_input("?")
line1 = raw_input("Line 1: ")
line2 = raw_input("Line 2: ")
line3 = raw_input("Line 3: ")
line = line1+"\n"+line2+"\n"+line3
print "\n Now we gonna write these lines in you file using write method"
target.write(line1+"\n"+line2+"\n"+line3)
# target.write(line)
print "Now we close the file"
target.close()