Python setattr() function

The setattr() function sets the value of the specified attribute of the specified object.

Syntax

Parameter

object: This parameter represents any object.

name: This parameter represents the name of the attribute you want to set.

value: It signifies the value you want to give the specified attribute.

Return

none

Example 1

Output

Example 2

Output

Pin It on Pinterest

Share This