Obtain list of values of a Dictionary in Python
In this tutorial, we will learn how to obtain list of values of a Dictionary in Python
• 1 min read
To obtain list of values of a Dictionary in Python, the dictionary offers values()
method. It returns a collection of type dict_values
.
If we want to get all the values of a dictionary as a type of list
, we can do so using list comprehension as follows.
The output of the preceding code will return a collection of values
of type list
as shown as follows.