Today, let's look at some common uses of dictionaries in Python. As for the study of dictionaries, we should know the definition and differences of dictionaries and the characteristics of other data structures, commonly used methods of operation. All right, let's get to the business!
1. Dictionary definitions
A dictionary is surrounded by curly braces, elements exist in the form of key-value pairs, and elements are separated by colons to become one of the data structures. is also the only data structure that has a mapping relationship. Keywords: key-value pairs, curly braces, variable, one of the series.
2. Dictionary Features
- Disordered
- Variable
- When there are duplicate keys to produce the default hold last
- To access a value by key
3. Dictionary common operation methods
- Create, access, modify, delete
- Keys ()
- VALUES ()
- Items ()
- Pop ()
- Popitems ()
- Update ()
- Get ()
- SetDefault ()
- Zip ()
1) Create, access, modify, delete
2)
3)
4)
5)
6)
7)
8)
9)
10)
Getting Started with Python basics-dictionaries