这样写为什么不行呢?
s = set(['Adam', 'Lisa', 'Paul']) L = ['Adam', 'Lisa', 'Bart', 'Paul'] for name in L: name in s if 'name in s'=Ture: s.remove(name) else: s.add(name) print s
s = set(['Adam', 'Lisa', 'Paul']) L = ['Adam', 'Lisa', 'Bart', 'Paul'] for name in L: name in s if 'name in s'=Ture: s.remove(name) else: s.add(name) print s
2017-06-15
举报