Dictionary get value without knowing the key

You just have to use dict.values().

This will return a list containing all the values of your dictionary, without having to specify any key.

You may also be interested in:

  • .keys(): return a list containing the keys
  • .items(): return a list of tuples (key, value)

Note that in Python 3, returned value is not actually proper list but view object.

Leave a Comment