class Goods:
id_count = 0
# Class method : The following is the way to write ornaments ,classmethod Used to define class methods
@classmethod
def generate_id(cls):
cls.id_count += 1
return cls.id_count
def __init__(self):
self.id = str(self.generate_id()).zfill(5)
self.name = ''
self.price = 0
self.discount = 1
g1 = Goods()
print(g1.id)