import timewith open('a.txt','w') as f: current_time=time.ctime() print 'write time now...' print current_time f.write(current_time)with open('a.txt','r') as f: print 'read time now...' print f.read()