Dictionary (dict)
Definition: Set of key-value pairs
Initialize: {}, {' 1 ': ' abc ', ' 2 ': ' Def '}
1. Add: Direct assignment of single data
Update (DICT2) ---Add dict2 elements to the dict, which overrides the key values in the dict when repeated
2. Delete:pop (key, [default]) ---If the dictionary key key exists, delete and return Dict[key], if not present, and do not give the default value, throw Keyerror exception
popitem () ---Delete any key-value pairs and return the key-value pair, which generates an exception if the dictionary is empty Keyerror
Clear ()--- slightly
3. Query:get (Key,[default]) ---Return the dictionary dict key key corresponding value, if this key is not present in the dictionary, returns the value of default (default defaults to None)
items () ---Returns a list that contains a tuple (key, value) in the dictionary
keys () ---Returns a list that contains all the keys in the dictionary
values () ---Returns a list that contains all the values in the dictionary
4. Modify: There is no direct modification of the corresponding elements of the method, directly assign the value can be
Python Learning Notes (5)--Dictionary of data Structures Dict