Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sorted dictionary multiple keys

mylist = sorted(mylist, key=itemgetter('name', 'age'))
mylist = sorted(mylist, key=lambda k: (k['name'].lower(), k['age']))
mylist = sorted(mylist, key=lambda k: (k['name'].lower(), -k['age']))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #sorted #dictionary #multiple #keys
ADD COMMENT
Topic
Name
5+7 =