Get List of Values From Dictionary - Python
Last Updated :
23 Jul, 2025
We are given a dictionary and our task is to extract all the values from it and store them in a list. For example, if the dictionary is d = {'a': 1, 'b': 2, 'c': 3}, then the output would be [1, 2, 3].
Using dict.values()
We can use dict.values() along with the list() function to get the list. Here, the values() method is a dictionary method used to access the values from the key: value pairs and we are then converting the values to a list by using the list() function.
Python
d = {'a': 1, 'b': 2, 'c': 3}
res = list(d.values())
print(res)
Using map() Function
In this method we use map() function, which applies a specific method (d.get in this case) to each key in the dictionary to retrieve its value.
Python
d = {'a': 1, 'b': 2, 'c': 3}
res = list(map(d.get, d.keys()))
print(res)
Explanation: map(d.get, d.keys()) calls d.get(key) for each key in d.keys() thus returning the values which are then converted to a list using list().
Using List Comprehension
In this method we use a list comprehension to iterate over the keys and access their values.
Python
d = {'a': 1, 'b': 2, 'c': 3}
res = [d[k] for k in d]
print(res)
Explanation: [d[k] for k in d] iterates through the keys (for k in d) and retrieves the value associated with each key (d[k]).
Using a For Loop
In this method we will use a Python loop to get the values of keys and append them to a new list called values and then we print it.
Python
d = {'a': 1, 'b': 2, 'c': 3}
res = []
for k in d:
res.append(d[k])
print(res)
Explanation: The loop iterates over d (keys by default) and appends d[k] (the value) to the list values.
Explore
Python Fundamentals
Python Data Structures
Advanced Python
Data Science with Python
Web Development with Python
Python Practice