I have this byte variable
testByte = b"\x02\x00\x30\x03\x35"
I would like to print it out
I've tried:
listTestByte = list(testByte)
However, I'm getting
[2, 0, 48, 3, 35]
I'm expecting it to be:
[2, 0, 30, 3, 35]
What you have are hexadecimal values. So what you're getting is what you should be getting. (Except that you should be getting [2, 0, 48, 3, 53] and not [2, 0, 48, 3, 35].)
If you want the list to have what you have in hexadecimal you can try converting it back to hexadecimal.
testByte = b"\x02\x00\x30\x03\x35"
listTestByte = list(testByte)
print(listTestByte) # [2, 0, 48, 3, 53]
listTestByteAsHex = [int(hex(x).split('x')[-1]) for x in listTestByte]
print(listTestByteAsHex) # [2, 0, 30, 3, 35]
Or use string operations, to split at '\x' depending on your purpose.
int() to get the value as string. If you still need 61 then I'd suggest using string operations.
30in\x30is a hexadecimal value.intvalues are printed using their decimal values. What exactly is it you want to do? What would you expectb"\xff"to print as?[2, 0, 48, 3, 53]