[Tutor] stumped again adding bytes

Luke Paireepinart rabidpoobear at gmail.com
Wed Feb 21 21:18:55 CET 2007


shawn bright wrote:
> Hey all, thanks for the help yesterday on finding out if an msb is set or not.
>
> i am now kinda stumped with discovering the value of two bytes together.
>
> ok, if i have two bytes that together make a number, how do i find that number?
> i know that i do not add them.
>
> like byte_a = 39
> byte_b = 138
>
> together, they make 2599
>
> in hex they look like this
> byte_a = 0x27
> byte_b = 0x8A
>
> together = 0x0A27
>
> i am making the integers with ord(a) and ord(b)
>
> how do i put them together ?
>   
 >>> int("0x0A27",16)
2599

Hope that helps :)
-Luke
> thanks
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>   



More information about the Tutor mailing list