根据代码进行学习
class Province:
momo = '中国的23个省之一'
def __init__(self, name, city, leader, flag):
self.Name = name
self.City = city
self.Leader = leader
self.__Flag = flag
def sport_game(self):
print self.Name + '在开运动会'
@staticmethod # 静态方法
def foo(self):
print '每个省都要好好发展'
@property # 特性
def bar(self):
print self.Name
def show(self):
print self.__Flag
def __me(self):
print 'i am zty'
def me(self):
self.__me()
gs = Province('甘肃', '兰州', 'zty', True)
print gs.momo
print gs.Name
print gs.City
print gs.sport_game()
Province.foo(gs)
gs.bar
gs.me()
gs._Province__me()
'''
'''
class tyzZ:
def __init__(self):
pass
def __del__(self):
print '销毁'
def go(self):
print 'go'
def __call__(self, *args, **kwargs):
print 'call'
zty = tyzZ()
zty()
zty.go()
'''
'''
class father():
def __init__(self):
self.Fname = 'name'
def func(self):
print 'father.func'
def bad(self):
print 'father smoke drink'
class son(father):
def __init__(self,name):
self.Sname = name
def qwe(self):
print 'son.func'
def bad(self):
father.bad(self)
s = son('ssssname')
s.func()
s.qwe()
s.bad()