l1 = ['a',1,'c','b',2,'b','c','d','a'] l2= sorted(set(l1),key=l1.index) print('l2:',l2) print('l1:',l1) #输出 #l2: ['a', 1, 'c', 'b', 2, 'd'] #l1: ['a', 1, 'c', 'b', 2, 'b', 'c', 'd', 'a'] # 相关知识整理 1.set(l1)集合,去除列表重复项 2.sorted()sorted(iterable, key=Non