import time
def timeit(func):
def wrapper():
start = time.clock() #//time.clock()是统计cpu时间 的工具
func()
end =time.clock()
result = end - start
print(result)
return wrapper
@timeit
def foo():
print('函数执行时间')
foo()
python装饰器
最新推荐文章于 2023-06-20 22:11:03 发布