python中删除list中重复的元素

l1 = ['b','c','d','b','c','a','a']
l2 = []
[l2.append(i) for i in l1 if not i in l2]

猜你喜欢

转载自blog.csdn.net/qq_25964837/article/details/80582874