class Foo: def __init__(self,x): self.x=x
def __del__(self): #在对象资源被释放时触发 print(‘-----del------‘) print(self)
f=Foo(100000)del fprint(‘=======================>‘)
Python __析构方法__del__
原文:http://www.cnblogs.com/wangmengzhu/p/7404098.html