How to sort list with dictionary?
This question already has an answer here:
You can use a lambda function and one of the following functions to sort:
If you want to sort in-place (modify the list):
L.sort(key = lambda d:d['age'])
If you want to create a new sorted list:
print sorted(L, key = lambda d:d['age'])
链接地址: http://www.djcxy.com/p/70784.html
上一篇: 将IOrderedEnumerable <KeyValuePair <string,int >>转换为Dictionary <string,int>
下一篇: 如何用字典排序列表?