- Python Data Structures and Algorithms
- Benjamin Baka
- 55字
- 2021-07-09 19:45:01
Membership, identity, and logical operations
Membership operators (in, not in) test for variables in sequences, such as lists or strings do what you would expect, x in y returns True if a variable x is found in y. The is operator compares object identity. For example, the following snippet shows contrast equivalence with object identity:
