关于装饰器记录程序运行时间以及记录运行次数的代码
import time
# def set_fun(func):
# count = 0
# def call_fuc():
# nonlocal count
# count += 1
# t1=time.time()
# func()
# t2=time.time()
# print("当前函数的时间为: %s "%(t2-t1))
#
# print("%s执行次数%d"%(func.__name__,count))
# return call_fuc
# @set_fun
# def test():
# print("ni ")
# time.sleep(1)
# test()
# # time.sleep(1)
# test()