s = set(['Adam', 'Lisa', 'Paul']) L = ['Adam', 'Lisa', 'Bart', 'Paul'] for x in L: if x in s: s.remove(x) else: s.add(x) print s 查看完整描述