Home > Backend Development > Python Tutorial > What is dict in python

What is dict in python

藏色散人
Release: 2019-06-22 14:28:29
Original
10235 people have browsed it

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}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template