python的sorted 函数、python列表排序
2016-09-01 15:27
489 查看
sorted 函数、列表排序根据b排序value =[{'a':1,'b':2},{'a':10,'b':11}]
import operator
sorted(value,key=operator.itemgetter("a"))
sorted(value,key=lambda value:value['b'])
Out:[{'a': 1, 'b': 2}, {'a': 10, 'b': 11}]
相关文章推荐
- python的排序函数sort,sorted在列表排序和字典排序中的应用详解和举例
- python中列表排序sort()方法或者内建函数sorted()
- python的排序函数sort,sorted在列表排序和字典排序中的应用详解和举例
- Python sorted函数对列表排序
- Python 的列表排序(用 operator 函数进行多级排序)
- python容器排序sort()和内建函数sorted()的区别
- Python实现互联网笔试题-百度-关于排序sorted()函数
- Python 列表排序方法reverse、sort、sorted详解
- Python列表排序 reverse、sort、sorted 操作方法详解
- Python中利用sorted()函数排序的简单教程
- Python的排序函数Sort,Sorted
- Python 列表排序方法reverse、sort、sorted详解
- Python 排序函数sorted
- Python 列表排序方法reverse、sort、sorted详解
- python 列表排序方法sort、sorted技巧篇(转自: aben)
- Python 列表排序方法reverse、sort、sorted详解
- Python 列表排序方法reverse、sort、sorted详解
- Python 列表排序方法reverse、sort、sorted操作方法
- python的排序函数sort,sorted
- Python 请用sorted对上述列表按名字和分数排序