I am parsing a file in Python by reading in a chunk of data at a time. Using struct.unpack, I can parse the chunk of data into integer, string, and other typed components.
The structure of the data is 64 bits of binary data and 64 bits of padding.
For instance
res = struct.unpack('>64s64x', s)
With this, I can unpack the struct into a 64 bit long "string" with 64 bits of padding.
My main goal is to take that 64 bit "string", res[0], and invert it. (switch the 1s to 0s and vice versa)
However, how do I cast this string to a bit array and process it?
Note - also printing res[0] gives a bunch of gibberish, not 1s and 0s, since the "string" itself is not a string representation of the binary data. The bit array is being treated as a string...