你这是装饰器。要定义一个show_time函数才行
你需要定义一个装饰器函数才行
def show_time(fun):
def print_time():
import time
s = time.time()
fun()
e=time.time()
print(e-s)
return show_time
return print_time
这个是查看程序函数运行时间的装饰器,你去试试
有帮助请点击右上角采纳,有问题继续交流,你的采纳是对我回答的最大的肯定和动力