Setattr() is a built-in function in Python that is used to set a specific value to an object's attribute. If the attribute doesn't exist, setattr() creates it. The syntax is setattr(object, 'attribute_name', value).