Skip to content

Instantly share code, notes, and snippets.

@IndhumathyChelliah
Created June 24, 2020 06:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IndhumathyChelliah/8f6c0ea0dba1635a8f02cad0299932e4 to your computer and use it in GitHub Desktop.
Save IndhumathyChelliah/8f6c0ea0dba1635a8f02cad0299932e4 to your computer and use it in GitHub Desktop.
from operator import itemgetter
d={'a':[1,2,9],'b':[3,2,5],'c':[1,1,2]}
#Sorted based on second element, then based on third element
print (sorted(d.values(),key=itemgetter(1,2)))
#Output:[[1, 1, 2], [3, 2, 5], [1, 2, 9]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment