### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Input and output »

# numpy.ndarray.tofile

`ndarray.``tofile`(fid, sep="", format="%s")

  Write array to a file as text or binary.

  Data is always written in ‘C’ order, independently of the order of a. The data produced by this method can be recovered by using the function fromfile().

  This is a convenience function for quick storage of array data. Information on endianess and precision is lost, so this method is not a good choice for files intended to archive data or transport data between machines with different endianess. Some of these problems can be overcome by outputting the data as text files at the expense of speed and file size.

  Parameters: | fid : file or string An open file object or a string containing a filename. sep : string Separator between array items for text output. If “” (empty), a binary file is written, equivalently to file.write(a.tostring()). format : string Format string for text file output. Each entry in the array is formatted to text by converting it to the closest Python type, and using “format” % item.

### Navigation

- index
- modules |
- next |
- previous |
- NumPy v1.3 Manual (DRAFT) »
- NumPy Reference »
- Routines »
- Input and output »