Learn Python practically
and Get Certified.
Reference Materials
Learn Python Interactively
Try Programiz PROLearn Python practically
and Get Certified.
Try Programiz PRO!
Learn Python practically
and Get Certified.
Python Dictionary Methods
A dictionary is a collection of key/value pairs. Python has various methods to work in dictionaries. In this reference page, you will find all the methods to work with dictionaries.
Python Dictionary clear()
Removes all Items
Python Dictionary copy()
Returns the Shallow Copy of a Dictionary
Python Dictionary fromkeys()
creates dictionary from given sequence
Python Dictionary get()
Returns Value of The Key
Python Dictionary items()
returns view of dictionary's (key, value) pair
Python Dictionary keys()
Returns View Object of All Keys
Python Dictionary pop()
removes and returns element having given key
Python Dictionary popitem()
Returns & Removes Latest Element From Dictionary
Python Dictionary setdefault()
Inserts Key With a Value if Key is not Present
Python Dictionary update()
Updates the Dictionary
Python Dictionary values()
returns view of all values in dictionary