一:初识
import time
def fun1():
print("哈哈哈")
time.sleep(2)
def timer(f):
def inner():
start_time=time.time()
f()
end_time=time.time()
print(end_time-start_time)
return inner
f=timer(fun1)
f()
一:初识
import time
def fun1():
print("哈哈哈")
time.sleep(2)
def timer(f):
def inner():
start_time=time.time()
f()
end_time=time.time()
print(end_time-start_time)
return inner
f=timer(fun1)
f()