Operator Functions

operator.delitem()

Delete a[b] from a mutable target; missing keys or invalid indices can raise exceptions.

Formal Syntax & Structure

python syntaxpython
operator.delitem(a, b, /)

Parameters & Attributes

NameTypeDescription
aobjectLeft operand or target object.
bobjectIndex, slice or mapping key.

Return Value

None

Returns None after performing the indicated mutation.

Working Example

Example Snippetpython
import operatordata=[1,2,3]print(operator.delitem(data,1))print(data)
Python Reference