[Numpy-discussion] Numeric - fromfile ?

Alexandre Fayolle alexandre.fayolle at logilab.fr
Tue Aug 23 00:16:10 CDT 2005


On Mon, Aug 22, 2005 at 01:27:55PM -0400, Hari Sundar wrote:
> Hi,
> 
> Is there a function similar to numarray's fromfile, to read a binary array 
> from a file ? What is the best way to read such a file into a Numeric array.

It depends on the format of the file. If it's a pickled Numeric array,
then the pickle module can read it back. Otherwise, you get to read the
file (by opening it first and calling its read() method) and you can use
the fromstring() function in numeric. However you need to know the type
of the array and its shape. 

-- 
Alexandre Fayolle                              LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr  http://www.logilab.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20050823/571f8a21/attachment.bin 


More information about the Numpy-discussion mailing list