I\'ve been reading up a lot on stuct.pack and hex and the like.
I am trying to convert a decimal to hexidecimal with 2-bytes. Reverse the hex bit order, then convert
Keep in mind that 'hex'(base 16 0-9 and a-f) and 'decimal'(0-9) are just constructs for humans to represent numbers. It's all bits to the machine.
The python hex(int) function produces a hex 'string' . If you want to convert it back to decimal:
>>> x = 36895
>>> s = hex(x)
>>> s
'0x901f'
>>> int(s, 16) # interpret s as a base-16 number