Python学习之列表排序

列表排序存在两个内置函数:sort和sorted,其区别在因而否改变原序列。 python 数字排序: >>> a [11, 22, 24, 21, 30, 12] >>> sorted(a)   #将a从小到大排序,不影响a自己结构 [11, 12, 21, 22, 24, 30] >>> sorted(a,reverse=True) #将a从大到小
相关文章
相关标签/搜索