[SciPy-user] Multicolumn file io

Nathan Bell wnbell@gmail....
Sat Feb 14 19:06:34 CST 2009

On Sat, Feb 14, 2009 at 4:44 PM, Stéfan van der Walt <stefan@sun.ac.za> wrote:
> np.savetxt('/tmp/data.txt', np.array([x, y]).T)
> or
> np.savetxt('/tmp/data.txt', np.array([x, y]).T, fmt='%.0f')

To that I'd add that if some columns are integers and others are
floats that fmt='%g' gives you the desired (compact) output even
though the combined array has a floating point type.

Nathan Bell wnbell@gmail.com

More information about the SciPy-user mailing list