删除对象属性

  1. class Person:
  2. def __init__(self, name, age):
  3. self.name = name
  4. self.age = age
  5.  
  6. def myfunc(self):
  7. print("Hello my name is " + self.name)
  8.  
  9. p1 = Person("Bill", 63)
  10.  
  11. del p1.age
  12.  
  13. print(p1.age)