Skip to content

Home

Dictionary values

Returns a flat list of all the values in a flat dictionary.

def values_only(flat_dict):
  return list(flat_dict.values())

ages = {
  'Peter': 10,
  'Isabel': 11,
  'Anna': 9,
}
values_only(ages) # [10, 11, 9]

More like this

Start typing a keyphrase to see matching snippets.