转载:python的排序函数sort,sorted在列表排序和字典排序中的应用详解和举例 http://wangwei007.blog.51cto.com/68019/1100742
python的排序函数sort,sorted在列表排序和字典排序中的应用详解和举例
python 列表list中内置了一个十分有用的排序函数sort,sorted,它可以用于列表的排序,以下是例子。
>>>a = [5,2,1,9,6]
>>> sorted(a) #将a从小到大排序,不影响a本身结构
[1, 2, 5, 6,
转载
2015-01-10 11:33:34 ·
789 阅读 ·
0 评论