From: hochberg at psn.net (Tim Hochberg)
Date: Mon, 10 May 1999 15:18:00 -0600
Subject: Numeric.tostring() ?
References: <7h7k9h$dme@cocoa.brown.edu>
Message-ID: <KUIZ2.182$M3.11503@news7.ispnews.com>
X-UID: 1880                                                 



Tom Lukasiak wrote in message <7h7k9h$dme at cocoa.brown.edu>...
>Hi,
>    I have found that the best way (or maybe the only way) to read a binary
>image into an array is to do something like this:
>
>f = open(filename)
>data = f.read()
>f.close()
>dataArray = Numeric.fromstring(data, Numeric.Int16)
>
>
>However, I run into trouble when I want to convert a Numeric array into a
>data string, so that I could save my array as a binary image file.  This is
>because there is no Numeric.tostring() method.  What is the best way to fix
>this problem?


There is a tostring method on array objects. For example:

dataArray.tostring()

should do what you want.

-tim







