Operator Functions
operator.setitem()
Assign value to a[b]. Mutates a supported target; does not return the assigned value.
Formal Syntax & Structure
python syntaxpython
operator.setitem(a, b, value, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| a | object | Left operand or target object. |
| b | object | Index, slice or mapping key. |
| value | object | Value to assign. |
Return Value
None
Returns None after performing the indicated mutation.
Working Example
Example Snippetpython
import operatordata=[1,2]print(operator.setitem(data,0,9))print(data)