PyDocs

Nav

Python Runtime Services

getattr

builtins

function
  • getattr(object, name, /)
  • getattr(object, name, default, /)
getattr(object, name[, default]) -> value

Get a named attribute from an object.

getattr(x, 'y') is equivalent to x.y.
When a default argument is given, it is returned when the attribute
doesn't exist; without it, an exception is raised in that case.
0 Examples
No examples for builtins/getattr.
See Also
No see-alsos for builtins/getattr
0 Notes
No notes for getattr