Re: Binary I/O

Guido.van.Rossum@cwi.nl
Sat, 13 Aug 1994 14:31:08 +0200

> Is there any way to read/write integers, doubles, etc. except as strings?
> I want to use python to control a realtime system via sockets. The
> overhead of converting to/from strings is more then I want to inflict on
> the realtime system.

Yes, the array module can read most numeric formats from strings
(where they are expressed in machine format) or files. It can also
write them back. An alternative would be to use the struct module,
which can also convert between strings containing machine format
numbers and Python values.

--Guido van Rossum, CWI, Amsterdam <Guido.van.Rossum@cwi.nl>
<URL:http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>