报错:TypeError: 'NoneType' object is not callable问题解决

报错:TypeError: ‘NoneType’ object is not callable问题解决方法

def dec(function):
    print("start...")
    function()
    print("end...")
#修饰器
@dec
def say():
    print("say...")
#执行报错:TypeError: 'NoneType' object is not callable
say()
# 解决方法:调用函数时去掉括号
say

猜你喜欢

转载自blog.csdn.net/wth_97/article/details/82347803