Python Dictionary Methods:
We can use the PyCharm code editor for this example. If you do not know about it then follow this link- How to install PyCharm for Python and create a program in it. |
(1) get()– Returns the value corresponding to the key passed as the argument. If the key is not present in the dictionary it will return none.

(2) keys()– Returns a list of keys in the dictionary.

(3) values()– Returns a list of values in the dictionary.

(4) items()– Returns a list of tuples (key-value) pairs.

(5) del– Deletes the item with the given key.

(6) pop()– Removes an element from the dictionary whose key is given as its argument.

(7) dict()– Creates a dictionary from a sequence of key-value pairs.

(8) update()– Updates the dictionary with the specified key and value.

(9) clear()– Deletes or clears all the items in the dictionary.

Comments (No)