how to write a numpy array to a file in python

numpy.savetxt(fname, X, fmt='%.18e', delimiter=' ', newline='\n', 
              header='', footer='', comments='# ', encoding=None)


x = y = z = np.arange(0.0,5.0,1.0)
np.savetxt('test.out', x, delimiter=',')   # X is an array
np.savetxt('test.out', (x,y,z))   # x,y,z equal sized 1D arrays
np.savetxt('test.out', x, fmt='%1.4e')   # use exponential notation

Here is what the above code is Doing:
1. The first argument is the filename.
2. The second argument is the data to be saved.
3. The third argument is the delimiter.
4. The fourth argument is the fmt.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default is a space.

The fmt argument is optional. The default is %7.4f.

The delimiter argument is optional. The default