装饰器与flask
import time
def timer(func):
def tic(*args,**kwargs):
starttime=time.time()
func(*args,**kwargs)
stoptime=time.time()
print('函数运行时间',stoptime-starttime)
return tic
@timer
def time1():
time.sleep(3)
time1()
原创
2021-12-27 13:54:04 ·
341 阅读 ·
0 评论