Python Dictionary keys() Method Tutorial

In this section we will learn what the Dictionary keys() method is and how to use it in Python.

What is Dictionary keys() Method in Python?

The Python Dictionary keys() method is used to get an object view of the target Dictionary that contains all its keys set as the items on a list.

Note that we’re saying a “view” of the keys in the target Dictionary! This means if one of the keys in the target dictionary changed, this view object will notice the change as well.

Python Dictionary keys() Method Syntax:


Dictionary keys() Method Parameter:

The method does not take an argument.

Dictionary keys() Method Return Value

The return value of this method is view object that contains the entire keys of the target Dictionary set as the items in a list.

Example: using python dictionary keys() method

dictionary = {




result = dictionary.keys()


dictionary["age"] = 200



dict_keys(['name', 'lastName'])

dict_keys(['name', 'lastName', 'age'])

Top Technologies