[Numpy-discussion] numpy arrays

Patrick Redmond plredmond at gmail.com
Sat Jun 9 15:09:25 EDT 2012

On Sat, Jun 9, 2012 at 2:12 PM, bob tnur <bobtnur78 at gmail.com> wrote:
>> how to save  multiple files like cm1.txt,cm2.txt,cm3.txt etc and to
>> produce their corresponding outputs cm1.out,cm2.out,cm3.out etc.
>    or how to modify this:
>    np.savetxt(fname, (a,b), fmt='%4.8f')

You can save them to separate files with a for loop.

for i, arr in enumerate([a, b]):
     fname = 'cm{}.out'.format(i + 1)
     np.savetxt(fname, arr, fmt='%4.8f')

More information about the NumPy-Discussion mailing list