如何访问私有方法
# -*- coding: utf-8 -*- #python 27 #xiaodeng #如何访问私有方法 class Securityp(object): def __my(self): print "Bet you can't see me..." b=Securityp() print dir(b) #打印出所有的方法和属性等信息 print b.__dict__ #没有打印结果 b._Securityp__my() ''' ['_Securityp__my', '__class__', '__delattr__', '__dict__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__'] {} Bet you can't see me... '''
无语言基础,自学python所做的各种笔记,欢迎大牛指点.