As
zude said, modulo-2 addition of binary numbers is the same as exclusive-OR. So you can read a character at a time from the two files, convert each character to a number with
ord, XOR these numbers together with
^, convert back to a character with
chr, then print that to the output file. You may be get faster performance using
pack and
unpack to deal with units larger than a single character.