【发布时间】:2021-08-27 12:29:15
【问题描述】:
class Computer:
def _inti_(self, storage, color , system):
no_of_Computer = 0
self.storage = storage
self.color = color
self.system = system
Computer.no_of_Computer +=1
def describe (self):
print(f'my storage is {self.storage} and my color is{self.color} and my system is {self.system}')
Computer_1 = ("1TB , silver , windows ")
Computer_2 = (" 4TB , black , linux")
Computer_3 = (" 9TB , white ,mac ")
Computer_1.describe()
【问题讨论】:
-
问题是什么?
-
首先,正确启动类,使用
__init__再试一次
标签: python-3.x class attributeerror