函数-(记录日志功能)

函数-(记录日志功能)

#_author:xing
#date:2019/11/1
import time
def fun(n):
time_format='%Y-%m-%d %X'
current_time=time.strftime(time_format)
with open('record_log','a',encoding='utf8') as f:
f.write('end function %s,%s\n'%(n,current_time))

def function1(n):
print('starting action1')
fun(n)
def function2(n):
print('starting action1')
fun(n)
def function3(n):
print('starting action1')
fun(n)
function1(1)
function2(2)
function3(3)
Output:

starting action1
starting action1
starting action1

函数-(记录日志功能)

上一篇:Android UI异常-----瞬间闪画面问题


下一篇:* daemon not running; starting now at tcp:5037