ndarray.tofile()

numpy.ndarray.tofile

ndarray.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 of a. The data produced by this method can be recovered using the function fromfile().

Parameters:

fid : file or str

An open file object, or a string containing a filename.

sep : str

Separator between array items for text output. If “” (empty), a binary file is written, equivalent to file.write(a.tobytes()).

format : str

Format string for text file output. Each entry in