我直接上脚本:
方法1:
代码语言:javascript复制#!/usr/bin/env python
n = [1,2,3,3,4,3,1,2,3,2,1,4,5,5,5,5,6,6,4,3,2,1,2,6,8,2]
m = []
for x in n:
if x not in m:
m.append(x)
print m
效果:
方法2:
利用set去重复:
代码语言:javascript复制#!/usr/bin/env python
staff_list = ['aa','bb','aa','bb','cc','aa','cc','bb']
print list(set(staff_list))
效果: