排序

sort 正向排序
li = [1,456,21,5,657,21]
li.sort()
print(li)
View Code
li = [1,456,21,5,657,21]
li.sort(reverse= False)
print(li)
View Code

 

倒向排序

li = [1,456,21,5,657,21]
li.sort(reverse= True)
print(li)
View Code

 

反转

li = [1,456,21,5,657,21]
li.reverse()
print(li)
View Code

posted @ 2019-07-19 23:12  套你大象  阅读(96)  评论(0编辑  收藏  举报