class Goods():标签:__,Goods,python,price,使用,._,property,self,def From: https://blog.51cto.com/haoyonghui/6019237
def __init__(self):
self._price = ""
@property
def price(self):
return self._price
@price.setter
def price(self, value):
self._price = value
@price.deleter
def price(self):
del self._price
g = Goods()
a = g.price
print(a)
g.price = 123
b = g.price
print(b)
del g.price