On 8 Jun 2005 14:49:00 -0700, [EMAIL PROTECTED] wrote:
>Hello,
>
>How do i pack different data types into a struct or an array. Examples
>would be helpful.
>
>Say i need to pack an unsigned char( 0xFF) and an long( 0xAAAAAAAA)
>into a single array? The reason i need to do this is send a packet over
>a network.

    >>> import struct
    >>> struct.pack('!BL', 0xff, 0xaaaaaaaa)
    '\xff\xaa\xaa\xaa\xaa'
    >>>

Jp
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to