# -*- coding: gbk -*- def uniq(ls):
lsCopy=[e for e in ls]
for i in xrange(1,len(ls)):
for j in xrange(i):
if ls[j]!=ls[i]:
pass
else:
lsCopy.remove(ls[i])#如果有removeAt(index)方法更好
return lsCopy if __name__=='__main__':
ls=[1,2,3,4,5,6,7,8,9,7,2,3,6]
print uniq(ls)
结果:[1, 4, 5, 8, 9, 7, 2, 3, 6]#remove(e)删除时从列表头开始找e