Replicating Javascript Bitwise Operation In Python August 28, 2023 Post a Comment I'm trying to replicate a simple bitwise Javascript operation in Python. [Javascript] > 0xA867Df55 2825379669 > 0xA867Df55 ^ 0 -1469587627 [Python] >>> 0xA867DFSolution 1: How about converting from uint32 to int32. importstructprintstruct.unpack('i', struct.pack('I', 0xA867Df55))[0] CopyOUTPUT-1469587627CopyOr as @Ashwini suggests:import ctypes print ctypes.c_int(0xA867DF55 ^ 0).value CopyOUTPUT-1469587627Copy Share Post a Comment for "Replicating Javascript Bitwise Operation In Python"
Post a Comment for "Replicating Javascript Bitwise Operation In Python"