私有方法的使用

 1 class Employee:
 2     __company = 'Asis'
 3 
 4     def __init__(self,name,age):
 5         self.name = name
 6         self.__age = age
 7 
 8     def __work(self):
 9         print('好好工作,努力赚钱娶媳妇儿!')
10         print('年龄:{0}'.format(self.__age))
11         print(Employee.__company)
12 
13 e = Employee('Xujie',18)
14 print(e.name)
15 print(e._Employee__age)
16 print(dir(e))
17 print(e._Employee__work())
18 print(Employee._Employee__company)