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
  • 115,751
  • 26
  • 228
  • 437
cymruu
  • 2,808
  • 2
  • 11
  • 23