报错: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

你可能感兴趣的:(报错:TypeError: 'NoneType' object is not callable问题解决)