On 2009-01-25, Ravi <ra.ravi....@gmail.com> wrote: > >> Take a look at the struct and ctypes modules. > > struct is really not the choice. it returns an expanded string of the > data and this means larger latency over bluetooth.
I don't know what you mean by "returns an expanded string of the data". I do know that struct does exactly what you requested. It converts between Python objects and what is bascially a C "struct" where you specify the endianness of each field and what sort of packing/padding you want. I use the struct module frequenty to impliment binary, communications protocols in Python. I've used Python/struct with transport layers ranging from Ethernet (raw, TCP, and UDP) to async serial, to CAN. -- -- http://mail.python.org/mailman/listinfo/python-list