'''
version: 0.2.0
Author: AbsoluteThree
Date: 2021-07-09 14:24:22
LastEditors: AbsoluteThree
LastEditTime: 2021-07-09 19:44:05
'''
def func(f):
i=0
def func1():
nonlocal i
i+=1
f()
print('函数运行了%s次'%i)
return func1
@func
def test():
pass
test()
test()
[Running] python -u "a:\LANGUAGE\py_text\a.py"
函数运行了1次
函数运行了2次
[Done] exited with code=0 in 0.117 seconds