[SciPy-user] a sequence of formats in savetxt

Scott Sinclair scott.sinclair.za@gmail....
Tue Nov 18 07:33:35 CST 2008

2008/11/18 Nils Wagner <nwagner@iam.uni-stuttgart.de>:
> How do I specify a sequence of formats in savetxt ?
> savetxt('f06.dat',F,fmt='%10.5f %i4 4%10.5f') doesn't work
> F is an (m,5) array.
> The entries of the second column should be stored as
> integers.

Your format string will need 5 different format specifiers if F has 5 columns.

>>> savetxt('f06.dat', F, fmt='%10.5f %4d %10.5f %10.5f %10.5f')

The above should work with your (m, 5) array, giving you an integer in
the second column of each line in the file, with all other columns
being floating point.

The documentation for savetxt is at


More information about the SciPy-user mailing list