Javatpoint Logo
Javatpoint Logo

Python Dictionary values() Method

Python values() method is used to collect all the values from a dictionary. It does not take any parameter and returns a dictionary of values. It returns an empty dictionary if the dictionary has no value. The syntax and examples of this method are given below.



No Parameter


It returns a dictionary of values.

Let?s see some examples of values() method to understand it?s functionality.

Python Dictionary values() Method Example 1

It is a simple example which returns all the values from the dictionary. An example is given below.


Stock available {'Fan': 200, 'Bulb': 150, 'Led': 1000}

Python Dictionary values() Method Example 2

If the dictionary is already empty, this method also returns an empty dictionary except any error or exception. See an example below.


Stock available {}

Python Dictionary values() Method Example 3

This example uses various methods to get information about dictionary such as length, keys etc.


Total number of values: 3
All the Keys: dict_keys(['Fan', 'Bulb', 'Led'])
Items: {'Fan': 200, 'Bulb': 150, 'Led': 1000}
Deleted items: ('Led', 1000)
Stock available {'Fan': 200, 'Bulb': 150}

Next TopicPython Dictionary

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA