Operator Functions
operator.contains()
Test whether b is contained in a. The container is the first argument, opposite the written order of b in a.
Formal Syntax & Structure
python syntaxpython
operator.contains(a, b, /)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| a | object | Container to search. |
| b | object | Value whose membership is tested. |
Return Value
bool
The bool result described above.
Working Example
Example Snippetpython
import operatorprint(operator.contains({"id": 7}, "id"))