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

Pauli Virtanen pav@iki...
Thu Nov 4 07:37:33 CDT 2010


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)



More information about the NumPy-Discussion mailing list