Sunday, 29 September 2013

Get list from list values in a python dictionary

Get list from list values in a python dictionary

I have a python dictionary with the following entries:
professions = {Peasant : ["Peasant", 10000], Merchant : ["Merchant",
15000], ...}
Is there a clever way to get a list of all profession names? I'd like a
function that returns
["Peasant", "Merchant", ...]
thanks for suggestions

No comments:

Post a Comment