Do you want to know the details about “how to write a numpy array to a file in python”. If yes, you’re in the correct tutorial.

## 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
```

## Final Thoughts

I hope this tutorial helps you to know about “how to write a numpy array to a file in python”. If you have any questions regarding this post please let us know via the comment section. Share this article with your friends & family via social networks.