struct.calcsize() giving odd results

Grant Edwards grante at visi.com
Tue Mar 12 18:16:06 EST 2002


In article <3Rvj8.27781$af7.23161 at rwcrnsc53>, John Purser wrote:

[regarding struct size that isn't what he wants]

> And that's it.  I tucked this into a variable (fmt) and ran it through
> struct.calcsize(fmt) and got 190.  I assumed I'd made a typo so I went over
> my string.  No problems there.  So I assumed I added it up wrong in the
> first place.  Nope, 180 bytes.

By default, struct will use the alignment/packing conventions
used by the native C compiler.  If you want something else,
you've got to specify it.  

Try adding a "=" to the front of your format string.

-- 
Grant Edwards                   grante             Yow!  ALFRED JARRY! Say
                                  at               something about th' DEATH
                               visi.com            of DISCO!!



More information about the Python-list mailing list