2019-01-26T09:36:57
Objective: Sort dictionary by nested dictionary value
Let's say we want to sort the following JSON by the nested dictionary value of count
.
{
"Mail": {
"count": 20,
"users": ["lukeskywalker", "darthvader"]
},
"Droid Sync": {
"count": 5,
"users": ["lukeskywalker"]
}
}
Method 1: lambda
apps_sorted = sorted(apps.items(), key=lambda x: …