Python Dictionary Methods

Python has some methods that dictionary objects can call. For example, dict1.clear() method removes all items from the dictionary dict1.

This page includes all dictionary methods available in Python 3. Also, the page includes built-in functions that can take dictionary as a parameter and perform some task. For example, the sort() function can take dictionary as a parameter and sort it.

Method Description
Python Dictionary clear() Removes all Items
Python Dictionary copy() Returns 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 popitem() Returns & Removes Element From Dictionary
Python Dictionary setdefault() Inserts Key With a Value if Key is not Present
Python Dictionary pop() removes and returns element having given key
Python Dictionary values() returns view of all values in dictionary
Python Dictionary update() Updates the Dictionary
Python any() Checks if any Element of an Iterable is True
Python all() returns true when all elements in iterable is true
Python ascii() Returns String Containing Printable Representation
Python bool() Converts a Value to Boolean
Python dict() Creates a Dictionary
Python enumerate() Returns an Enumerate Object
Python filter() constructs iterator from elements which are true
Python iter() returns iterator for an object
Python len() Returns Length of an Object
Python max() returns largest element
Python min() returns smallest element
Python map() Applies Function and Returns a List
Python sorted() returns sorted list from a given iterable
Python sum() Add items of an Iterable
Python zip() Returns an Iterator of Tuples