【发布时间】:2020-08-29 01:33:42
【问题描述】:
我收到 AttributeError: 'Test' object has no attribute 'a'。我不明白代码有什么问题。请指教。
class Test():
def __int__(self):
self.a = 1
t = Test()
print(t.a)
【问题讨论】:
-
它的
__init__不是__int__。 -
嗨,欢迎来到 StackOverflow!请在询问之前阅读指南 - stackoverflow.com/help/how-to-ask
标签: python python-3.x