a_file = open("test.txt", "w") for row in an_array: np.savetxt(a_file, row) a_file.close()
np.savetxt(fileDir, M, delimiter=" ", fmt="%10.6f") # where M can be one or more than one array, a matrix, etc.