class My(object):
def __init__(self, name, skill):
self.name = name
self.skill = skill
self.cry()
def cry(self): # 实例方法,必须实例化之后才可以调用
print('%s在哭。。。' % self.name)
def learn(self):
self.skill = ['开车']
def my_self(self):
print('我的名字是%s,我会%s' % (self.name, self.skill))
wsl = My('老虎', ['跑步']) # self = wsl
wsl.skill = '浪'
wsl.learn()
wsl.my_self()