实例化对象名._类名__私有属性名
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直接访问私有属性的简单方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。
最后
以上就是清脆薯片最近收集整理的关于python直接访问私有属性的简单方法的全部内容,更多相关python直接访问私有属性内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复