Why can't I xor strings?
bh at intevation.de
Mon Oct 11 12:55:36 CEST 2004
aleaxit at yahoo.com (Alex Martelli) writes:
>> Grant Edwards:
>> > No, he explained exactly what he was trying to do, and it had
>> > nothing to do with encryption. He wants to know if exactly one
>> > (1) of the strings is the empty string.
> not str1 ^ not str2
> not str1 != not str2
These give syntax errors, actually. I wouldn't have expected that
either, though :)
> str1 != str2 and (str1+str2) == (str2+str1)
>>> str1 = "x"; str2 = "xx"
>>> str1 != str2 and (str1+str2) == (str2+str1)
Intevation GmbH http://intevation.de/
More information about the Python-list