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 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() method

Returns & Removes Latest 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() function

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 an iterator

Python len()

Returns Length of an Object

Python max()

returns the largest item

Python min()

returns the smallest value

Python map()

Applies Function and Returns a List

Python sorted() function

returns a sorted list from the given iterable

Python sum()

Adds items of an Iterable

Python zip()

Returns an iterator of tuples