消去Python中list的重复元素

来源:互联网 发布:泰安知金复读怎么样 编辑:程序博客网 时间:2024/04/28 13:49

原文地址:http://www.peterbe.com/plog/uniqifiers-benchmark

 

Fastest way to uniqify a list in Python

 

Suppose you have a list in python that looks like this:

 ['a','b','a']
 # or like this:
 [1,2,2,2,3,4,5,6,6,6,6]

and you want to remove all duplicates so you get this result:

 ['a','b']
 # or
 [1,2,3,4,5,6]

 

 

原创粉丝点击