numpy savetext in one line code example Example: numpy savetext in one line np.savetxt("file.txt", array.flatten(), fmt="%.3d", newline = ", ")