class People():
def __init__(self,name):
self.name = name
def _var(self):
print('this is var')
def __doublevar(self):
print('this is doublevar')
def func(self):
self.__doublevar()
p = People('xiaoming')
p._var() # this is var
p.func() # this is doublevar
p.__doublevar() # AttributeError: 'People' object has no attribute '__doublevar'
07-07
796
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
12-12
3150
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)