struct.pack returns nothing [3]
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Mar 19 19:25:05 EDT 2007
En Mon, 19 Mar 2007 19:32:41 -0300, Andrés Martinelli
<andres at lacordilleraandina.com.ar> escribió:
> I'm using the example of the site
> http://docs.python.org/lib/module-struct.html :
>
> import struct
> pack('hhl', 1, 2, 3)
That code should raise a NameError. Either you are using *another* pack
function, or that is not what you actually typed.
This is what I get:
Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
py> import struct
py> struct.pack('hhl', 1, 2, 3)
'\x01\x00\x02\x00\x03\x00\x00\x00'
> I should get:
>>>> '\x00\x01\x00\x02\x00\x00\x00\x03'
Maybe on another platform - on i386 I get the byte ordering as above.
--
Gabriel Genellina
More information about the Python-list
mailing list