Operator Functions
operator.getitem()
Read a[b], where b can be an index, slice or mapping key depending on a.
Formal Syntax & Structure
python syntaxpython
operator.getitem(a, b, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| a | object | Left operand or target object. |
| b | object | Index, slice or mapping key. |
Return Value
object
The object result described above.
Working Example
Example Snippetpython
import operatorprint(operator.getitem([10,20,30],slice(1,None)))