标签:time() inner python highlight flag login timer lse tar
import time flag=1 def time_out(flag): def timer(func): def inner(*arg,**kwargs): if flag: start_time=time.time() ret=func(*arg,**kwargs) end=time.time()-start_time return ret else: ret=func(*arg,**kwargs) return ret return inner return timer @time_out(flag=flag) def login_demo(*args,**kwargs): return args,kwargs a=login_demo("nimei") print(a)
标签:time() inner python highlight flag login timer lse tar
原文地址:https://www.cnblogs.com/yuan-x/p/14256275.html