[Numpy-discussion] Another question on reading from binary FORTRAN file
Michael S. Gilbert
michael.s.gilbert at gmail.com
Tue Mar 10 11:37:24 EDT 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.
Regards,
Mike
More information about the NumPy-Discussion
mailing list