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從大到小
相關文章
相關標籤/搜索