注册 登录
编程论坛 Python论坛

关于实例化对象时的参数问题

杨杰2001 发布于 2021-10-12 16:34, 746 次点击

程序代码:

class TreeNode(object):
 
    def __int__(self, MyAttribute, SonAttribute, FartherValue, Result):
        self.MyAttribute = MyAttribute
        self.SonAttribute = SonAttribute
        self.FartherValue = FartherValue
        self.Result = Result

Node1 = TreeNode(2, 3, 4, 5)

print(Node1.MyAttribute)
print(Node1.SonAttribute)

为什么编译器一直显示实例化对象的时候参数有问题啊,但是我看别人电脑有没有问题 难道是我电脑的问题吗
2 回复
#2
自由而无用2021-10-12 16:56
null

[此贴子已经被作者于2021-11-4 17:54编辑过]

#3
apull2021-10-12 18:11
init,不是 int
1