I am trying to send hex data to a device from my nodemcu board in the "\xff\x00" format. Below code perfectly produces the hex string without any problem:
Code: Select all
data = [0xff, 0xff, 0xfd, 0x00]
print(bytes(data))
Note the '%' at the end. the ascii code for '%' is 0x25 or 37.
What I need is b'\xff\xff\xfd\x25'. Is there a workaround?