跟着博客學了點python的知識
dict: 類與對象的所有成員;
類輸出的是全局的函數,變量等信息。
對象輸出的只是對象擁有的普通變量而已
# http://python.jobbole.com/83747/
class Province:
country = 'China'
def __init__(self, name, count):
self.name = name
self.count = count
def func(self, *args, **kwargs):
print 'func'
print Province.__dict__
obj1 = Province('HeBei', 10000)
print obj1.__dict__
obj2 = Province('HeNan', 3888)
print obj2.__dict__
{'country': 'China', '__module__': '__main__', 'func': <function func at 0x1074191b8>, '__init__': <function __init__ at 0x1074190c8>, '__doc__': None}
{'count': 10000, 'name': 'HeBei'}
{'count': 3888, 'name': 'HeNan'}