标签:car def mil pre func transport size python style
class Transport:
‘交通工具‘
def __init__(self,name, type, place):
self.name=name
self.type=type
self.place=place
function=‘运输‘
def pick(self):
print(‘%s%s在%s上跑‘ % (self.name,self.type,self.place))
car=Transport(‘林肯‘,‘汽车‘,‘陆地‘)
Transport.pick(car)
car.time=‘10 year‘
print(car.function)
def test(self):
print(‘%s起步速度快‘%self.name)
Transport.test=test
Transport.test(car)
标签:car def mil pre func transport size python style
原文地址:https://www.cnblogs.com/cxydnxs/p/12327053.html