用装饰器实现打印时间
import time
def b(func):
def call_time(*args,**kwargs):
start_time=time.time()
ret=func(*args,**kwargs)
end_time=time.time()
c=end_time-start_time
print(c)
return call_time
@b
def test(*args,**kwargs):
for i in range(100):
print(i)
test()