delattr(object, name)
Removes the attribute name from object. The attribute (property, method, element) will be removed if the object supports this action. Use this method when the attribute name is stored in a variable and not known in advance.
Parameters
delattr() takes two parameters:
object- the object from which the attributenamemust be removedname- a string representing the name of the attribute to remove fromobject
Return Value
delattr() does not return any value (returns None). It only removes the attribute if the object allows it.
Examples
string = "Hello"
string.upper() # HELLO
delattr(string, 'upper')
string.upper() # AttributeError