Python 列表排序

Submitted by Lizhe on Wed, 05/03/2017 - 16:43

from audioop import reverse
books = ['b1','b2','b3','b1'];
books.reverse() #永久颠倒顺序

sortedBooks = sorted(books,reverse=True); #返回一个倒序排序
print(books);
print(sortedBooks);

books.sort(reverse=True); #永久倒序排序
print(books);