>>>L = [4,3,5,3,2,5] >>>temp = list(set(L)) >>>print temp [2,3,4,5] >>>temp.sort(key = L.index) >>>print temp [4,3,5,2]
>>>temp = [] >>>for i in L: >>> if i not in temp: >>> L.append(i)
>>>L = {‘abc‘, ‘ABD‘, ‘aBe‘}
>>>L.sort()
>>>L
[‘ABD‘, ‘aBe‘, ‘abc‘]
>>>L.sort(key=str.lower,reverse=True)
>>>L
[‘aBe‘,‘ABD‘,‘abc‘]原文:http://blog.csdn.net/magicharvey/article/details/18052801