recarray.tofile(fid,sep="",format="%s")¶Write array to a file as text or binary (default).
Data is always written in ‘C’ order, independent of the order ofa.The data produced by this method can be recovered using the functionfromfile().
| Parameters: |
|
|---|
Notes
This is a convenience function for quick storage of array data.Information on endianness and precision is lost, so this method is not agood choice for files intended to archive data or transport data betweenmachines with different endianness. Some of these problems can be overcomeby outputting the data as text files, at the expense of speed and filesize.
When fid is a file object, array contents are directly written to thefile, bypassing the file object’swrite method. As a result, tofilecannot be used with files objects supporting compression (e.g., GzipFile)or file-like objects that do not supportfileno() (e.g., BytesIO).