python去除slice和list的重复元素

来源:互联网 发布:知乎怎么看浏览记录 编辑:程序博客网 时间:2024/06/05 10:50

python去除slice和list的重复元素

转自:http://studygolang.com/articles/9622

python自带的系统函数就能做到

a=["a", "b", "c", "c", "e", "f", "a", "g", "b", "b", "c"]print(list(set(a)))a=[1, 1, 2, 4, 6, 7, 8, 4, 3, 2, 5, 6, 6, 8]print(list(set(a)))

输出:

['e', 'g', 'b', 'c', 'a', 'f']
[1, 2, 3, 4, 5, 6, 7, 8]


0 0