'bool' object is not callable

报错:'bool' object is not callable

原因:is_authenticated是属性而不是方法

解决:把括号去掉就可以了

demo:

class A():
    def __init__(self, x):
        self.x = x

    def add(self):
        return 3

a1 = A(12)
res = a1.x()
print(res)

报错:

        TypeError: 'int' object is not callable

posted @ 2022-12-14 23:13  半日闲1  阅读(753)  评论(0编辑  收藏  举报