0

I want to convert the byte string to hex for below variable.I want the result as DTCLogged[loopindex] = 0xDA

>>> DTCLogged[loopindex]
   'DA'

After that it should satisfy the IF condition

if (DTCLogged[loopindex] & 0xC0)

How can I do it?

1 Answers1

0

Parse it as a hexadecimal integer:

x = int(DTCLogged[loopindex], 16) & 0xC0
jonrsharpe
  • 107,083
  • 22
  • 201
  • 376
cymruu
  • 2,568
  • 2
  • 10
  • 21