Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to sort a list of dictionary by value in descending order?

1. new_list = sorted(old_list, key=lambda k: k['key'], reverse=True)
/*use reverse=False for ascending order*/
 
PREVIOUS NEXT
Tagged: #sort #list #dictionary #descending
ADD COMMENT
Topic
Name
4+1 =