Start of main content
Dictionary values
Python, Dictionary, List · Nov 2, 2020

Returns a flat list of all the values in a flat dictionary.
- Use
dict.values()
to return the values in the given dictionary.
- Return a
list()
of the previous result.
def values_only(flat_dict):
return list(flat_dict.values())
ages = {
'Peter': 10,
'Isabel': 11,
'Anna': 9,
}
values_only(ages)
More like this

A snippet collection of list helpers and tips for Python 3.6.
Collection · 100 snippets

Combines two or more dictionaries, creating a list of values for each key.
Python, Dictionary · Apr 4, 2021

Retrieves the value of the nested key indicated by the given selector list from a dictionary or list.
Python, Dictionary · Oct 28, 2020

Creates a dictionary with the same keys as the provided dictionary and values generated by running the provided function for each value.
Python, Dictionary · Nov 2, 2020