2020년/Development
list value를 가진 dictionary 정렬
위지원
2020. 6. 3. 17:00
myDict = { 'item1' : [ 7, 1, 9], 'item2' : [8, 2, 3], 'item3' : [ 9, 3, 11 ] }
>>> sorted(myDict.items(), key=lambda e: e[1][2]) [('item2', [8, 2, 3]), ('item1', [7, 1, 9]), ('item3', [9, 3, 11])]
https://stackoverflow.com/questions/1217251/python-sorting-a-dictionary-of-lists
Python: sorting a dictionary of lists
Still learning python (finally!) and can't quite wrap my head around this one yet. What I want to do is sort a dictionary of lists by value using the third item in the list. It's easy enough sort...
stackoverflow.com