On 2007-05-24, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>> You should really use the struct module for that type of conversion, but
>> you also need to know that indexing of lists and tuples starts at 0, not 1.
>
> indeed, i used to have temp = unpack('h', tBuf[1,3])

Which probably should have been

temp = unpack('h', tBuf[1:3])[0]

But that still doesn't do the same thing as your example which
only used 7 bits from each byte.

> but it was a hack (and as such a bit off ;) as i was having
> troubles casting

Python doesn't have "casting".

-- 
Grant Edwards                   grante             Yow! A can of ASPARAGUS,
                                  at               73 pigeons, some LIVE ammo,
                               visi.com            and a FROZEN DAQUIRI!!
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to