[FRPythoneers] 24 bit number

John M. Purser jmpurser at attbi.com
Mon Feb 3 11:24:13 MST 2003

I'm reading an ISAM database with Python and for most of the files it works
fine.  However I have 83 fields (out of several thousand total) that are
(believe it or not) 24 bit integers!  Most are unsigned but a few are
signed.  I've approached the problem by decoding them as a 16 bit signed or
unsigned integer and an 8 bit integer using the struct module.  I'll
multiply the 16 bit nuber by 256 then add it to the 8 bit number and put it
in MySql as a 32 bit number.

Can anyone think of a better approach?

John Purser

More information about the FRPythoneers mailing list