函数

import  time
def logger():
time_format = '%Y-%m-%d %X'
time_current = time.strftime(time_format)
with open('a.txt','a+') as f:
f.write('%s end action\n' %time_current)
def test1():
print('in the test1')
logger()
def test2():
print('in the test2')
logger()
def test3():
print('in the test3')
logger()

test1()
test2()
test3()



2018-11-06 11:32:07 end action
2018-11-06 11:32:07 end action
2018-11-06 11:32:07 end action
posted @ 2018-11-06 11:33  rongye  阅读(165)  评论(0编辑  收藏  举报