getattr: a Better Way to Get the Attribute of a Class
getattr: a Better Way to Get the Attribute of a Class
The getattr(class, attribute_name) method gets the value of an attribute of a class. However, if the attribute is not found in a class, it returns the default value provided to the function.