Python getattr() Function for getting the value of a class attribute.
Oct 11, 2022
Python getattr() Function: The getattr() function returns the value of the specified attribute (property or method) from the specified object.
If the specified attribute does not exist, default value is returned.
Syntax: getattr(object, attribute, default)
Parameters:
object: object whose attribute is to be returned
attribute: attribute name whose value is to be returned
default: default value to be returned if the attribute does not exist
Return Value: value of the specified attribute