Update sort_dict_by_value.md
This commit is contained in:
committed by
GitHub
parent
6169dda836
commit
b202f2f433
@ -3,7 +3,7 @@ title: sort_dict_by_value
|
||||
tags: dictionary,intermediate
|
||||
---
|
||||
|
||||
Sorts the given dictionary by key.
|
||||
Sorts the given dictionary by value.
|
||||
|
||||
- Use `dict.items()` to get a list of tuple pairs from `d` and sort it using a lambda function and `sorted()`.
|
||||
- Use `dict()` to convert the sorted list back to a dictionary.
|
||||
|
||||
Reference in New Issue
Block a user