import time
def test1():
time.sleep(3)
print(“test1”)
def test2():
time.sleep(3)
print(“test2”)
#装饰器的实现
def timmer(func):
def dect():
start_time=time.time()
func()
end_time=time.time()
print(“this is run time %s”%(end_time-start_time))
return dect
#装饰器的调用
t=timmer(test1)
t()