Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# -*- coding: utf-8 -*-
# Reference: Python Cookbook 2 Ed. p.198
def get_sorted_dict_values(d):
keys = d.keys()
keys.sort()
return [d[key] for key in keys]
if __name__ == '__main__':
d = dict(aaa=100, ddd=600, bbb=300, eee=150, ccc=200)
print(d)
print(get_sorted_dict_values(d))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.