[Numpy-discussion] Another question on reading from binary FORTRAN file
Tue Mar 10 10:05:06 CDT 2009
This seems to be a really easy way.
One more question.
It turns out my file also contains a character string of 16 characters.
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.
> From: Michael Gilbert <email@example.com>
> fid = open( 'fort.out' , 'r' )
> junk = numpy.fromfile( fid , numpy.int , 1 )
> integer = numpy.fromfile( fid, numpy.int , 1 )
> junk = numpy.fromfile( fid , numpy.int , 2 )
> floats = numpy.fromfile( fid , numpy.float , 16 )
More information about the Numpy-discussion