Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # sort_by_dict_value_as_kv_list.py
- x = {'a': 2, 'b': 0, 'c': 3, 'd': 1, 'e': 4}
- sorted_x = sorted(x.items(), key=lambda kv: kv[1])
- print sorted_x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement