待去重列表
lt1 = [1,3,2,3,4,5,3,5]
lt2 = list(set(lt1))
lt2 = list({}.fromkeys(lt1).keys())
lt2 = sorted(set(lt1),key=lt1.index)
lt2 = [] [lt2.append(i) for i in lt1 if not i in lt2] 即: lt2 = [] for i in lt1: if i not in lt2: lt2.append(i)
func = lambda x,y:x if y in x else x + [y] lt2 = reduce(func, [[], ] + lt1)
for x in lt1: while lt1.count(x)>1: del lt1[lt1.index(x)]
原文:https://www.cnblogs.com/tingguoguoyo/p/10957216.html