sorted

字母排序是根据ascii表进行排序的

In [16]: sorted([1,3,2,5,0,-1])
Out[16]: [-1, 0, 1, 2, 3, 5]

In [17]: sorted([1,3,2,5,0,-1], reverse=True)
Out[17]: [5, 3, 2, 1, 0, -1]

In [18]: sorted(['a', 'd', 'c', 's', 'e'], reverse=True)
Out[18]: ['s', 'e', 'd', 'c', 'a']

In [19]: sorted(['a', 'd', 'c', 's', 'e'])
Out[19]: ['a', 'c', 'd', 'e', 's']

results matching ""

    No results matching ""