Jan Troler wrote:
Ahoj Vsem,
narazil jsem na nasledujici chovani modulu struct:
In [12]: struct.pack('HI',8,1), struct.calcsize('HI')
Out[12]: ('\x08\x00\x00\x00\x01\x00\x00\x00', 8)
Je to standardni chovani, struct.pack dela defaultne alignment:
The optional first format char indicates byte order, size and alignment:
@: native order, size & alignment (default)
=: native order, std. size & alignment
<: little-endian, std. size & alignment
>: big-endian, std. size & alignment
!: same as >
Davej jednoduse vsude na zacatek fmt vykricnik a vse bude
v network endianu a bez alignmentu.
>>> struct.pack ('HI', 8, 1)
'\x08\x00\x00\x00\x01\x00\x00\x00'
>>> struct.pack ('!HI', 8, 1)
'\x00\x08\x00\x00\x00\x01'
--
Zdenek
_______________________________________________
Python mailing list
[email protected]
http://www.py.cz/mailman/listinfo/python