[Numpy-discussion] array 2 string

josef.pktd@gmai... josef.pktd@gmai...
Tue Mar 10 12:02:35 CDT 2009

On Tue, Mar 10, 2009 at 11:37 AM, Pierre GM <pgmdevlist@gmail.com> wrote:
> Simplifying the loops from a previous poster:
>  >>>  "\n".join((" ".join((str(_) for _ in x)) for x in a))
> - Show quoted text -

or if you want to control the formatting, e.g.

print "\n".join(("%-10.6f "*a.shape[1] % tuple(x) for x in a))

print "\n".join(("%6d"*a.shape[1] % tuple(x) for x in a))

More information about the Numpy-discussion mailing list