The setattr() function in Python is used to dynamically set the value of an attribute for an object. If the attribute doesn't already exist, it will create the attribute for the specified object.
Syntax:
python
Copy code
setattr(object, name, value)