装饰器

def deco(func):
def wrapper():
print("1 before myfunc() called.")
func()
print(" 2 after myfunc() called.")
return wrapper


@deco
def myfun():
print("myfun")
myfun()
原文地址:https://www.cnblogs.com/mljqqh/p/6916911.html