Python read values from dict:

The values() method returns a new view of the dictionary values as a list referred to as “dict_values”. Since this is a view of the dictionary, all the updates made to the dictionary are also visible.

Method signature

The signature for the values() method is as shown below. Here, d refers to the dictionary, and v is a view over the dictionary.


Method parameters and return type

  • The values() method takes no parameters.
  • However, it returns a view object that displays values as a list.

Python Dictionary values Examples:

Example 1:

In this case, let us take a dictionary with numbers assigned to colour names. Here, we will extract all the values as a list. Moreover, we can see list is named as dict_values.

# Using values method
print("View has ",v1)


View has dict_values(["Red","Blue","Green"])

Example 2:

Let us take a dictionary with numbers assigned to a list containing names in this example. Firstly, let us add the new key-value pair to the dictionary. As we can see, it automatically updates the view.

print("Before update view has ",v1)
#Adding new key value pair
print("After update view has ",v1)


Before update view has  dict_values([['Jim', 'Kim'], ['John', 'Tom'], ['Riya', 'Siya']])
After update view has  dict_values([['Jim', 'Kim'], ['John', 'Tom'], ['Riya', 'Siya'], ['X', 'Y']])

Example 3:

We will take a dictionary with the department name and student name in this case. Here, we will delete the key “Comp”. As a result, changes are reflected in the view also.

# Using values method
print("Before Delete view has ",v1)
print("After Delete view has ",v1)


Before Delete view has  dict_values(['Jim', 'Tom', 'Siya'])
After Delete view has  dict_values(['Tom', 'Siya'])


The values() method extracts values from the dictionary as a list. Just because this is a view over the dictionary, all the updates made to the dictionary are also reflected in the view.


Happy Learning 🙂

Leave A Comment