A "for" with "list" question.

Frank Buss fb at frank-buss.de
Sun Sep 1 13:47:34 EDT 2002


BTW: If you want the second case, only, you can write:

>>> from operator import xor
>>> a = [0, 1, 2]
>>> b = [1, 2, 3]
>>> [item for item in a + b if xor(item in a, item in b)]
[0, 3]

-- 
Frank Buß, fb at frank-buss.de
http://www.frank-buss.de, http://www.it4-systems.de



More information about the Python-list mailing list