Home  >  Article  >  Backend Development  >  What is dict in python

What is dict in python

藏色散人
藏色散人Original
2019-06-22 14:28:2910221browse

What is dict in python

What is dict in python?

dict is a variable data type in python, use { } means that the key of dict must be an immutable data type, while the data type of value can be arbitrary.

Format:

{key:value,key:value,key:value}

Note: If the key-value pair is a string, use single quotes, and the last key-value pair does not have a comma.

Advantages of dict:

①: Fast query speed, binary search possible

②: Key cannot be repeated

Note:  

Immutable data types: tuple, bool, int, str can hash

Variable data types: dict, list, set

Related recommendations:《 Python Tutorial

The above is the detailed content of What is dict in python. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn