How to get a list of values from a dictionary in Python

Getting a list of values from a dictionary results in a list that contains all the values of the dictionary. For example, the list of values for {“a”: 1, “b”: 2, “c”: 3} is [1, 2, 3].

Solution for How to get a list of values from a dictionary in Python : You can use dict.values() to get a list of values Call dict.values() to get the values of the dictionary. Use list(object) with object as the values of the dictionary to convert it into a list.


how-to-get-a-list-of-values-from-a-dictionary-in-python