【发布时间】:2019-06-01 10:47:31
【问题描述】:
我只想正确解释为什么使用对象打印 __init__method 会给出“无”输出。
class cars:
wheels = 4
def __init__(self):
self.mil = 10
self.company = "BMW"
c1 = cars()
print(c1.__init__())
【问题讨论】:
-
__init__不返回任何内容 - 这在 python 中意味着它返回None。
标签: python python-3.x oop