Take 3*4 array A as an example:
1. A.tofile ("Filename.bin")
This method can only be saved as a binary file, and cannot save the row and column information of the current data, the file suffix is not necessarily bin or txt, but does not affect the save format, are binary.
This method of saving is required for data reading, and it is necessary to manually specify the Dtype of the read data, and if the specified format is inconsistent with the save time, the wrong data is read.
b = Numpy.fromfile ("Filename.bin", Dtype = * *)
The data read is a one-dimensional array that needs to be used
B.shape = 3,4 The number of dimensions is re-specified.
2.numpy.save ("Filename.npy", a)
With this method, the suffix name of the saved file must be set to. NPY, this format is best used only
Numpy.load ("filename") to read.
3.numpy.savetxt ("Filename.txt", a)
b = Numpy.loadtxt ("filename.txt")
For handling one-and two-dimensional arrays
NumPy Saving Data