通用装饰器
def wrapper(fun): def inner(*args,**kwargs): print(f"before execute target {fun} ") ret=fun() print(f"after execute target {fun}") return ret return inner @wrapper def fun(*args,**kwargs): print("test") return 1
2024-02-19 10:15:58
通用装饰器
def wrapper(fun): def inner(*args,**kwargs): print(f"before execute target {fun} ") ret=fun() print(f"after execute target {fun}") return ret return inner @wrapper def fun(*args,**kwargs): print("test") return 1
下一篇:txt2db