Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sort list based on sublist

li = [["Jake", 24], ["Harry", 20]]
li.sort(key=lambda x: x[1]) #Sorts based on 1st element of each sublist
 
PREVIOUS NEXT
Tagged: #python #sort #list #based #sublist
ADD COMMENT
Topic
Name
9+7 =