struct,long on 64-bit machine

Hrvoje Niksic hniksic at xemacs.org
Mon Nov 19 07:31:00 EST 2007


Neal Becker <ndbecker2 at gmail.com> writes:

> What's wrong with this?
> type(struct.unpack('l','\00'*8)[0])
> <type 'int'>
>
> Why I am getting 'int' when I asked for 'long'?

C longs are converted to Python integers; see the table on
http://docs.python.org/lib/module-struct.html.  If you really need the
Python long, use long(...).



More information about the Python-list mailing list