ctypes and byte order

Terry Reedy tjreedy at udel.edu
Thu Jun 18 13:02:16 EDT 2015


On 6/18/2015 5:39 AM, Jean-Michel Pichavant wrote:

> I'm currently writing python code that writes a small binary file to
> be used by another device which code is written in C. The python code
> runs on a little endian CPU, and unfortunately, the other device is
> using a big endian MIPS.

The struct module is designed for this.  It reads and writes packed 
binary data of various types and sizes in either big or little endian 
order.  It should be easier than ctypes.

-- 
Terry Jan Reedy




More information about the Python-list mailing list