sorted()
#coding:utf-8
#sorted Ascending 升序
L = [12,23,43,3,65,34,21,3645]
print(sorted(L))
>>>output
[3, 12, 21, 23, 34, 43, 65, 3645]
#sorted Descending 降序
print(sorted(L,reverse = True))
>>>output
[3645, 65, 43, 34, 23, 21, 12, 3]
标签:list sort log pytho code source reverse coding gpo
#coding:utf-8
#sorted Ascending 升序
L = [12,23,43,3,65,34,21,3645]
print(sorted(L))
>>>output
[3, 12, 21, 23, 34, 43, 65, 3645]
#sorted Descending 降序
print(sorted(L,reverse = True))
>>>output
[3645, 65, 43, 34, 23, 21, 12, 3]
标签:list sort log pytho code source reverse coding gpo
原文地址:http://www.cnblogs.com/pualus/p/8042449.html