pack heterogeneous data types

Christopher Subich spam.csubich+block at block.subich.spam.com
Wed Jun 8 17:53:05 EDT 2005


ashokbellur at gmail.com 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.

Look at the struct module, struct.pack sounds like what you need.



More information about the Python-list mailing list