Python NumPy: Save a NumPy array to a text file - w3resource
w3resource
Python Exercises

Python NumPy: Save a NumPy array to a text file

Python NumPy: Array Object Exercise-32 with Solution

Write a Python program to save a NumPy array to a text file.

Sample Solution:-

Python Code:

import numpy as np
a = np.arange(1.0, 2.0, 36.2)
np.savetxt('file.out', a, delimiter=',')

Python Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a Python program to get the values and indices of the elements that are bigger than 10 in a given array.
Next: Write a Python program to find the memory size of a NumPy array.

What is the difficulty level of this exercise?