Python · Function
setattr
setattr() assigns a value to an object's named attribute. It is useful when the attribute name is stored in a string or computed at runtime.
Last updated
Syntax
setattr(object, name, value, /)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
getattr()delattr()__getattribute__()__slots__