Course
Simulator
More
Premium
Log in
Python Function Reference
Functions
getattr
getattr
Return the value of the named attribute of object. name must be a string.
Python 3.13
1
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
1
getattr
(
'hello'
,
'upper'
)
'HELLO'