[Tutor] stumped again adding bytes

Kent Johnson kent37 at tds.net
Wed Feb 21 21:34:44 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.
> 
> i am making the integers with ord(a) and ord(b)
> 
> how do i put them together ?

If this is related to your earlier posts about reading a binary file, 
you should look at the struct module, rather than turning each byte into 
an integer and assembling them yourself.

You might also look into Construct which is a higher-level way of doing 
similar jobs.
http://construct.wikispaces.com/

Kent



More information about the Tutor mailing list