在函数前面加上功能函数:
eg:
def outer_func():
pass

@outer_func
def inner_func():
pass
则会给inner_func函数加上outer_func函数的功能

具体运行原理参见下图:
python装饰器

相关文章:

  • 2021-05-07
  • 2021-05-01
猜你喜欢
  • 2021-05-29
  • 2022-12-23
  • 2022-12-23
  • 2021-07-27
  • 2021-12-17
  • 2021-04-19
相关资源
相似解决方案