xxxmenger 发表于 2017-4-30 14:33:49

Python列表去重复

def unique_list(seq, excludes=[]):
"""
返回包含原列表中所有元素的新列表,将重复元素去掉,并保持元素原有次序
excludes: 不希望出现在新列表中的元素们
"""
seen = set(excludes)# seen是曾经出现的元素集合
return
  参考:
  http://www.peterbe.com/plog/uniqifiers-benchmark
页: [1]
查看完整版本: Python列表去重复