实例化对象名._类名__私有属性名
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直接访问私有属性的简单方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持脚本之家。