9951 explained code solutions for 126 technologies


python-numpyHow to save Numpy array to text file


import numpy as np

array = np.array([1,2,3,4,5])
np.savetxt('/tmp/numpy.txt', array)ctrl + c
import numpy as np

load Numpy module for Python

np.array

declare Numpy array

.savetxt

saves specified array to text file

/tmp/numpy.txt

path to text file to save array to

array

array to save to text file