Binary input into NumPy.

Martin Lüthi answer at
Mon Sep 9 19:23:38 CEST 2002

>From the manual:

fromstring(string, typecode) 

Will return the array formed by the binary data given in string of the
specified typecode. This is mainly used for reading binary data to and from
files, it can also be used to exchange binary data with other modules that use
python strings as storage (e.g. PIL). Note that this representation is
dependent on the byte order. To find out the byte ordering used, use the
byteswapped() method described on page47.

Hope this helps


Maurice van de Rijzen <maurice at> writes:

> Dear all,
> I just downloaded Numerical Python and I think it will be very usefull.
> However I have one major broblem:
> I don't know how to import binary data from a file on disk into an array!
> Can onyone help me with this problem?

Martin Lüthi                 answer at

More information about the Python-list mailing list