Pyserial never read

Peter Hansen peter at engcorp.com
Thu Feb 23 13:58:33 EST 2006


Dennis Lee Bieber wrote:
>>>>dt = "D0360000EC"
>>>>print repr("".join([chr(int(dt[2*x:2*x+2],16)) for x in range(len(dt)//2)]))
> 
> '\xd06\x00\x00\xec'

By the way, for future reference, this way beats the above hands down:

 >>> import binascii
 >>> binascii.unhexlify("D0360000EC")
'\xd06\x00\x00\xec'


-Peter




More information about the Python-list mailing list