使用列表推导,只保留元素个数等于1的123a = ['a', 'b', 'c', 'd', 'a', 'a']b = [x for x in a if a.count(x) == 1]print b列表推导中的x for x in a if a.count(1) == 1和下面的for循环等价,不过更简洁:12345b = []for x in a: if a.count(x) == 1: b.append(x)print b