python直接访问私有属性的简单方法
发布时间:2016-12-28 来源:查字典编辑
摘要:实例化对象名._类名__私有属性名classFlylove:price=123def__init__(self):self.__direct...
实例化对象名._类名__私有属性名
class Flylove: price = 123 def __init__(self): self.__direction = 'go beijing .' zIng = 'wait car,many person' if __name__ == '__main__': print Flylove.price fly = Flylove() print fly._Flylove__direction
以上这篇python直接访问私有属性的简单方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持查字典教程网。