Adding, deleting, modifying and checking instance objects in Python

#Add , delete, modify and check the instance object 
p1 = ChinesePeople( 'wangyue')
#print (p1.__dict__) #View

the attributes of the instance object
#print (p1.name)
(p1.play_ball( "basketball")) #Call the function of the class Attribute #Add
the attribute of the instance object
p1.age = 18
print p1. __dict__
print p1.age #Delete
the attribute of the instance object
# del p1.age
# print p1.__dict__ #Modify

the attribute of the instance object
p1.age = 19
print p1. age

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325122259&siteId=291194637