import re
import datetime
import time
#niru's git commit
while True:
    #open the file for reading
    
file = open("test.txt")
    content = file.read()
    
    #Get timestamp
    ts = time.time()
    ist = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d %H:%M:%S')
    
    #open file for read and close it neatly(wrap code in try/except)
    #with open('test.txt', 'r') as r:
    #content = r.read()
    
    #print content
    #Search the entire content for '@' and replace it with time stamp.
    new_content = re.sub(r'@.*', ist, content)
    print new_content
    
    #open file for write and close it neatly(wrap code in try/except)
    with open('test.txt', 'w') as f:
        f.write(new_content)
        print "torpid loop complete"
    
    time.sleep(5)