struct module

Thomas Jensen thomasNO at SPAM.obscure.dk
Sat Oct 20 13:48:27 CEST 2001


"nobody" <root@[127.0.0.1]> wrote in
news:3bd0f13e$0$27332$afc38c87 at news.optusnet.com.au: 

> Can someone tell me what I'm missing here?
> 
>>>> struct.calcsize('H') 2 struct.calcsize('B') 1
>>>> struct.calcsize('HB') 
> 3
> 
> wait for it...
> 
>>>> struct.calcsize('BH')
> 4
> 
> ?

Try this:

>>> struct.calcsize('BH')
4
>>> struct.calcsize('=BH')
3

If I'm reading the docs correctly, this should be standard across 
platforms.

-- 
Thomas Jensen



More information about the Python-list mailing list