📜  为 House Class 实例创建类 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:03.352000             🧑  作者: Mango

代码示例1
class House(object):
   def __init__(self, size, color):
         self.color = color
         self.size = size

bluehouse = House(4, "blue")
redhouse = House(2, "red")
print bluehouse.color #Prints 'blue'
print redhouse.color # Prints 'red'