def zhuangshiqi(func): def wrapper(): print('开始装饰') func() print('装饰结束') return wrapper 闭包的进阶运用 @zhuangshiqi # 相当于执行了:test = zhuangshiqi(test) def test(): print('致我们的小美好') # t2 = zhuangshiqi(test) # t2() # test = zhuangshiqi(test) test() @zhuangshiqi def demo(): print('我们的未来') demo()