Packing a long long type

Martin von Loewis loewis at informatik.hu-berlin.de
Thu Jun 21 09:56:43 EDT 2001


crj003 at yahoo.com (Rich J) writes:

> Does anyone know how it would be possible to pack a list containing
> 'long long' types (like 111111111111111L) and other standard types
> (int, string, char). I know you can use the struct module to pack all
> but the 'long long'. I also know you can use the xdrlib module to pack
> the 'long long'. Any ideas?

The Python version in the CVS supports a 'q' format, see

http://python.sourceforge.net/devel-docs/lib/module-struct.html

For Python 2.1, you probably need to split the long long into two
longs, and pack them separately. Notice that the order in which to
pack them depends on endianness.

Regards,
Martin




More information about the Python-list mailing list