-Destructors are called when an object gets destroyed. In Python, destructors are not needed as much needed in C++ because Python has a garbage collector that handles memory management automatically.
-The __del__() method is a known as a destructor method in Python. It is called when all references to the object have been deleted i.e when an object is garbage collected.
print("Object is created")
print("Object is deleted")
#create object and delete
Object is created
Object is deleted
-In this program, we create a class A, then we create an object so that constructor is automatically call then we delete the object of the class by del(a) then destructor function __del__() is automatically call.