去重
a=[1,2,4,2,4,5,6,5,7,8,9,0]
<1> a=[1,2,4,2,4,5,6,5,7,8,9,0] a2=set(a) print(a2)
<2> a=[1,2,4,2,4,5,6,5,7,8,9,0] #用list类的sort方法 #保持他们原来的排序: a2 = list(set(a)) a2.sort(key=a.index) print(a2)
posted on 2017-11-08 21:01 似不是傻 阅读(132) 评论(0) 编辑 收藏 举报