pythonluaequivalent

Python equivalent of lua bit32.bxor


I am trying to "convert" a lua script into a python script, but the lua script seems to have a library named bit32, and of which it uses the bxor function. Is there any python equivalent of the bit32.bxor function?

I have searched multiple times on stackoverflow and google for what the equivalent is, but i didn't find any. Maybe I'm just searching the wrong stuff...


Solution

  • Is the script trying to calculate Exclusive OR of 2 integers ? if so you can use the bitwise operator ^

    >>>8 ^ 16
    24