代码代码问题在哪
class Person(object):
def __init__(self, name, score):
self.name=name
self.__score=score
p = Person('Bob', 59)
print p.name
try:
print p.__score
except:
print "AttributeError"
print p.__score
报错:Traceback (most recent call last):
File "index.py", line 14, in
print p.__score
AttributeError: 'Person' object has no attribute '__score'
Bob
AttributeError