class Person:
def del(self): print('销毁对象:{0}'.format(self))
P1 = Person()P2 = Person()print(P1)print(P2)del P2print('程序结束')
你的del方法写错了吧,应该是 “__del__”