class Food:
foodCount = 0
def __init__(self,name,price):
self.name = name
self.price = price
def prt(self):
print(self.name+"is"+str(self.price))
def add(self):
self.foodCount+=1
food2 = Food("卷心菜",19)
print(food2.name,food2.price)
food2.prt()
food2.add()
print(food2.foodCount)
food2.price = 18
print(food2.price)
print("----------------------------")
print( getattr(food2,'name') )
print(hasattr(food2,'age'))
setattr(food2,"count",10)
print(getattr(food2,'count'))
delattr(food2,'count')
print("----------------------------")
print(food2.__dict__)
print(food2.__doc__)