Lecture 36: Check, add, and delete operations of Python collection elements

The elements in the collection cannot be modified, but can be added and deleted.

1. Check operation of collection elements

Operators can be used to check the existence of an element in a collection.

  • in: Checks if the specified element is in the collection.
  • not in: Checks if the specified element is not in the collection.

Both operators return a boolean value type.

For the query operation of a collection, you can only query whether the element is in the collection. The collection is stored out of order and there is no index. Therefore, you cannot query the specified element through the index, nor can you query the Value through the Key like a dictionary.

1) Check the specified meta

Guess you like

Origin blog.csdn.net/weixin_44953658/article/details/130258864