Chinaunix首页 | 论坛 | 博客
  • 博客访问: 735447
  • 博文数量: 95
  • 博客积分: 1754
  • 博客等级: 上尉
  • 技术积分: 1607
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-12 10:06
文章分类

全部博文(95)

文章存档

2015年(3)

2013年(15)

2012年(77)

分类: Python/Ruby

2013-02-18 22:53:34

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

 

阅读(4944) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~