Following is my code
#!/usr/bin/python
from sys import argv
x, file_name = argv
print "planning to erase file %r. " , file_name
tgt=open(file_name,'r+')
print "deleting"
tgt.truncate()
print tgt.read()
print " no lines "
print "closed : ", tgt.closed
print "mode : ", tgt.mode
l1 = raw_input("line1 : ")
l2 = raw_input("line2 : ")
l3 = raw_input("line3 : ")
tgt.write(l1)
tgt.write('\n')
tgt.write(l2)
tgt.write('\n')
tgt.write(l3)
print "after writing"
print tgt.read()
print "Going to replace "
tgt.close()
Last read statement does not display data. But the file is updated with 3 lines I entered. Can any help