首页 > 其他分享 >'bool' object is not callable

'bool' object is not callable

时间:2022-12-14 23:22:34浏览次数:53  
标签:__ self object callable 报错 bool

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

标签:__,self,object,callable,报错,bool
From: https://www.cnblogs.com/yu121/p/16983949.html

相关文章