Python Function Reference

getattr
Return the value of the named attribute of object. name must be a string.
Python 3.13
getattr(object, name, default=None)
object
The object.
name
The name of the attribute.
default
The default value if the attribute is not found.
Examples
Python 3.13
>>> getattr('hello', 'upper')
'HELLO'