A dictionary is another mutable container model and can store any type of object.
Each key value pair in the dictionary is separated by ': ', each pair is separated by ', ', and the entire dictionary is included in the {}
The key must be unique, but the value does not have to be.
The value can take any data type, but the key must be immutable, such as a string, a number, or a tuple.
To access the values in the dictionary:
Dictionary operations: Increase
Dictionary operation: Delete pop (key)
Removes a key value pair from the dictionary by specifying the key value, which returns the value of the deleted key
You must specify the key to delete, or the error
Dictionary Delete: Clear ()
Dictionary operation: Change
Dictionary operations: Check Get (), SetDefault (), Has_key ()
Get (Key): finds the corresponding value by the given key, and returns none if the given keys do not exist in the dictionary
SetDefault (Key): finds the corresponding value by a given key, returns none if the given key does not exist in the dictionary, and adds a key-value pair to the dictionary
Dictionary operation: Facelift () Set the dictionary key-value pairs, group members, and finally return as a list
Dictionary operations: Keys (), VALUES ()
Dictionary operation: Update (DICT1) updates the key-value pairs in the dictionary dict1 to the dictionary
Dictionary operation:
Items () An iterator that returns all elements of the dictionary
Keys () returns an iterator consisting of all keys in the dictionary
VALUES () returns an iterator that consists of all values in the dictionary
Fromkeys (seq): Creates a dictionary that is the key to the dictionary of elements in the sequence SEQ, and value is the initial value corresponding to all keys in the dictionary
Copy (): Shallow copy of Dictionary
Common ways to manipulate Python dictionaries