The Python dictionary contains the following built-in methods:
Serial Number |
Functions and descriptions |
1 |
Radiansdict.clear () Delete all elements in a dictionary |
2 |
Radiansdict.copy () Returns a shallow copy of a dictionary |
3 |
Radiansdict.fromkeys () Create a new dictionary with the keys to the dictionary in sequence seq, Val is the initial value corresponding to all keys in the dictionary |
4 |
Radiansdict.get (Key, Default=none) Returns the value of the specified key if the value does not return the default value in the dictionary |
5 |
Key in Dict Returns False if the key returns true in the dictionary Dict |
6 |
Radiansdict.items () Returns an array of traversed (key, value) tuples as a list |
7 |
Radiansdict.keys () Returns a dictionary of all keys in a list |
8 |
Radiansdict.setdefault (Key, Default=none) Similar to get (), but if the key does not exist in the dictionary, the key is added and the value is set to default |
9 |
Radiansdict.update (DICT2) Update the key/value pairs of the dictionary dict2 to the Dict |
10 |
Radiansdict.values () Returns all values in the dictionary as a list |
11 |
Pop (Key[,default]) Deletes the value of the dictionary given key key, and returns the value to be deleted. The key value must be given. Otherwise, the default value is returned. |
12 |
Popitem () Randomly returns and deletes a pair of keys and values in the dictionary (typically delete the end pair). |
Python dictionary built-in methods