Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort defaultdict by value

>>> sorted(data.items(), lambda kv: kv[1], reverse=True)
[('hello', 23), ('ciao', 17), ('bye', 14)]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #defaultdict
ADD COMMENT
Topic
Name
8+3 =