__init__调用之二

class Bar:
def __init__(self,name,age):
self.suibian = name #self后的名字是啥,对象就可以调用啥,而不是 __init__ 后括号形参
self.a = age
# def show(self):
# print('%s - %s' %(self.a, self.n))
#
#


z = Bar('abc',123)
print(z.suibian)
# z.show()
posted on 2019-01-31 13:46  Jarrel  阅读(400)  评论(0)    收藏  举报