官术网_书友最值得收藏!

  • Learn Python in 7 Days
  • Mohit Bhaskar N. Das
  • 67字
  • 2021-07-09 20:40:27

Membership operators

Python has two membership operators to test the membership in a sequence, such as a string, list, tuple, and others:

The following screenshot will make it clearer for you:

In the preceding screenshot, we try to search for the character, 'o', in the string, 'John', and it returns True. However, 'k' is not present in the string, and hence, it returns False.

主站蜘蛛池模板: 申扎县| 宝坻区| 色达县| 垫江县| 理塘县| 扎鲁特旗| 关岭| 平潭县| 卓资县| 策勒县| 武宁县| 武乡县| 巴南区| 桦南县| 阿拉尔市| 焦作市| 垦利县| 渝中区| 望城县| 铜山县| 武宁县| 汉寿县| 丽水市| 许昌市| 谷城县| 通城县| 托里县| 叶城县| 古浪县| 广南县| 临沧市| 平邑县| 许昌县| 木兰县| 镇平县| 江阴市| 延寿县| 松阳县| 卢龙县| 乌鲁木齐市| 威宁|