Home >>Python Dictionary Methods

Python Dictionary Methods

Python Dictionary Methods

Python dictionary is a collection of key/value pairs. Python has multiple methods to work in dictionaries. Through this reference tutorial page, you will get all the methods related to dictionaries.

Method Description
clear() It is used to removes all the elements from the dictionary.
copy() It is used to return a copy of the dictionary.
fromkeys() It is used to return a dictionary with the specified keys and value.
get() It is used to return the value of the specified key.
items() It is used to return a list containing a tuple for each key value pair.
keys() It is used to return a list containing the dictionary's keys.
pop() It is used to remove the element with the specified key.
popitem() It is used to remove the last inserted key-value pair.
setdefault() It is used to return the value of the specified key. If the key does not exist then insert the key, with the specified value.
update() It is used to update the dictionary with the specified key-value pairs.
values() It is used to return a list of all the values in the dictionary.

Learn more about Python dictionaries Python dictionaries


Python Dictionary Methods Index

Sr.No. Topics
1 Python Dictionary clear() Method
2 Python Dictionary copy() Method
3 Python Dictionary fromkeys() Method
4 Python Dictionary get() Method
5 Python Dictionary items() Method
6 Python Dictionary keys() Method
7 Python Dictionary pop() Method
8 Python Dictionary popitem() Method
9 Python Dictionary setdefault() Method
10 Python Dictionary update() Method
11 Python Dictionary values() Method

Learn Latest Tutorials