Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort python dictionary with values of list by index of first one

>>> collections.OrderedDict(sorted(a.iteritems(), key=lambda (k,v):v[0], reverse=True))
OrderedDict([('key2', [7, 7]), ('key3', [5, 10]), ('key1', [2, 3])])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #python #dictionary #values #list #index
ADD COMMENT
Topic
Name
4+1 =