Guaranteeing an n-byte data type?

2009-01-09 Thread Evan Jones
Hello all, I'm trying to use sockets to implement a pre-defined network protocol that requires that I send messages of exactly a certain number of bytes. In Python, integer values are represented as 4 bytes each (AFAIK.) However I don't want to always send 4 bytes: sometimes I want to send one byt

Re: Guaranteeing an n-byte data type?

2009-01-09 Thread Evan Jones
On Fri, Jan 9, 2009 at 11:56 AM, Grant Edwards wrote: > In addition to previous suggestions, you should look at the > "struct" and "ctypes" modules in the standard Python library. > Both allow you to pack/unpack data to/from data structures with > arbitrary layout and endianness. > > Thank you, e