请教像我这么做有什么简便的方法没?
s = set(['Adam', 'Lisa', 'Paul']) L = ['Adam', 'Lisa', 'Bart', 'Paul'] temp = set([]) for a in s: for b in L: if a != b: temp.add(b) for a in s: for b in L: if a == b: temp.remove(b) s = temp print s
s = set(['Adam', 'Lisa', 'Paul']) L = ['Adam', 'Lisa', 'Bart', 'Paul'] temp = set([]) for a in s: for b in L: if a != b: temp.add(b) for a in s: for b in L: if a == b: temp.remove(b) s = temp print s
2015-05-04
举报