The values method
The values method returns all dictionary values. The values are returned as a special object dict_values. We do not specify anything in the method parameter.
Syntax
dictionary.values()
Example
Let's get all the meanings from our dictionary:
dct = {
'a': 1,
'b': 2,
'c': 3
}
print(dct.values())
Result of code execution:
dict_values([1, 2, 3])
Example
Let's get all the values as a list:
dct = {
'a': 1,
'b': 2,
'c': 3
}
print(list(dct.values()))
Result of code execution:
[1, 2, 3]