[Tutor] stumped again adding bytes

Kent Johnson kent37 at tds.net
Wed Feb 21 21:47:00 CET 2007


shawn bright wrote:
> oh, sorry, i meant how to get the 0x0A27 out of two bytes
> a = 0x27 and b = 0x8A

Why is the correct result not 0x8A27 ?

Maybe this is what you want:
 >>> a=0x27
 >>> b=0x8a
 >>> (b & 0x7f) * 256 + a
2599

Kent



More information about the Tutor mailing list