python直接访问私有属性的简单方法
发布时间:2020-12-16 20:29:19 所属栏目:Python 来源:网络整理
导读:实例化对象名._类名__私有属性名 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 以上
实例化对象名._类名__私有属性名 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直接访问私有属性的简单方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程小技巧。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |