输出结果:
"""-------------------- nf.__dict__ 与 f.__dict__ 对比 --------------------{'role': 'father', 'name': 'lilei', 'salary': 1000}{'role': 'son', 'name': 'liwei', 'salary': 2000, 'kind': 'salesman'}{'kind'}-------------------- NewFamily.__dict__ 与 Family.__dict__ 对比 --------------------{'__module__': '__main__', '__doc__': '\n 定义一个公共账号 ,只要有人上班,就将钱存到这个账号上\n ', 'share_money': 0, 'native_place': ['china'], '__init__': <function Family.__init__ at 0x000001EC8159D288>, 'work': <function Family.work at 0x000001EC8159D318>, 'fun': <function Family.fun at 0x000001EC8159D3A8>, '__dict__': <attribute '__dict__' of 'Family' objects>, '__weakref__': <attribute '__weakref__' of 'Family' objects>}{'__module__': '__main__', 'new_account': 0, '__init__': <function NewFamily.__init__ at 0x000001EC8159D438>, 'work': <function NewFamily.work at 0x000001EC8159D4C8>, '_NewFamily__expenditure': <function NewFamily.__expenditure at 0x000001EC8159D558>, '__doc__': None}{'_NewFamily__expenditure', 'new_account'}-------------------- dir(nf) 与 dir(f) 对比 --------------------['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'fun', 'name', 'native_place', 'role', 'salary', 'share_money', 'work']['_NewFamily__expenditure', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'fun', 'kind', 'name', 'native_place', 'new_account', 'role', 'salary', 'share_money', 'work']{'_NewFamily__expenditure', 'new_account', 'kind'}-------------------- dir(NewFamily) 与 dir(Family) 对比 --------------------['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'fun', 'native_place', 'share_money', 'work']['_NewFamily__expenditure', '__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'fun', 'native_place', 'new_account', 'share_money', 'work']{'_NewFamily__expenditure', 'new_account'}"""
经验总结扩展阅读
- 温度升高电阻怎么变化
- 2023年属蛇人最佳结婚日子是哪几天 属蛇人结婚吉日查询
- 2023年适合属马人结婚的吉日查询 属马人结婚吉日查询
- 2023年适合属羊人结婚的吉日查询 属羊人结婚吉日查询
- 2023年属猪人结婚的良辰吉日查询 属猪人结婚吉日查询
- 属兔2023本命年年结婚好吗挑选良辰吉日结婚安全幸福
- 美赫吊顶属于几线品牌?
- 88年属龙的是什么命
- 沌口属于武汉哪个区
- 奥迪A3适合男人开吗