[Numpy-discussion] Another question on reading from binary FORTRAN file

Michael S. Gilbert michael.s.gilbert@gmail....
Tue Mar 10 10:37:24 CDT 2009

On Tue, 10 Mar 2009 16:05:06 +0100, Mark Bakker wrote:

> Thanks, Mike.
> This seems to be a really easy way.
> One more question.
> It turns out my file also contains a character string of 16 characters.
> I tried
> np.fromfile(fd,np.str,16)
> But that gives an error.
> Can I read a characterstring with fromfile?
> I know, I can read with fd.read, but I am wondering if there is an
> option for fromfile as well.

Strings are indeed supported by numpy.  You're looking for the
"numpy.character" data type.


More information about the Numpy-discussion mailing list