Definition
The delattr() function will delete the specified attribute from the specified object.
Syntax
delattr(object, attribute)
Parameters
Parameter | Description |
---|---|
object | Required. An object. |
attribute | Required. The name of the attribute you want to remove. |
Examples
class Student:
name = "Mark"
age = 16
country = "Germany"
print(getattr(Student, 'age'))
delattr(Student, 'age')
getattr(Student, 'age')