Nov-23-2021, 09:13 AM
(This post was last modified: Nov-23-2021, 09:13 AM by Gribouillis.)
Convert to int first.
>>> hex(int('0x1ab', 0) & 255) '0xab'That said, I have the feeling that you should be working with bytes from the very beginning instead of str.