Created
April 7, 2019 07:45
-
-
Save anapaulagomes/28fa022a85f7c1d63a8257ca5bedf200 to your computer and use it in GitHub Desktop.
Order a dict by value
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# stolen from https://stackoverflow.com/questions/20944483/python-3-sort-a-dict-by-its-values | |
[(k, d[k]) for k in sorted(d, key=d.get, reverse=True)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment