@相当于在一个函数中调用另一个函数,并执行操作

def funA(x):
    print(x())
    print('-----------------over---------------')

@funA
def funB():
    return 'hello'

 

相当于执行funA(funB())

所以x()相当于funB(),括号一定要写。

而且定义完funB()后就执行了funA(x),不用在代码后再写funA()了。

python @的用法

相关文章:

  • 2021-08-30
  • 2022-01-02
  • 2022-01-18
  • 2021-12-27
  • 2021-12-19
  • 2022-03-02
  • 2021-11-27
猜你喜欢
  • 2022-12-23
  • 2021-11-29
  • 2021-06-23
  • 2021-05-22
  • 2021-11-06
  • 2021-05-31
  • 2021-08-01
相关资源
相似解决方案