[Numpy-discussion] problem with a binary file on OS X 10.6

Francesc Alted faltet at pytables.org
Thu Nov 4 08:54:29 EDT 2010


A Thursday 04 November 2010 13:37:33 Pauli Virtanen escrigué:
> Thu, 04 Nov 2010 13:33:48 +0100, Francesc Alted wrote:
> [clip]
> 
> > To solve this, just apply byteswap once more:
> >>>> a = np.int32(300)
> >>>> a.byteswap().byteswap()
> > 
> > 300
> > 
> > and you are done.
> 
> Or directly specify big-endian byte order when reading
> 
> 	fromfile(fp, '>i4', 3)

Much, much better :-)

-- 
Francesc Alted



More information about the NumPy-Discussion mailing list