[Numpy-discussion] printing array in tabular form

Daπid davidmenhur at gmail.com
Thu May 9 04:59:37 EDT 2013

On 9 May 2013 10:06, Sudheer Joseph <sudheer.joseph at yahoo.com> wrote:
> However writing a formatted out put looks to be bit tricky with python
> relative to other programing languages.

If performance is not an issue, you could do it by hand, as you can
always do in any programming language:

savefile = open('data.txt', 'w')
N = len(IL)

for start in xrange(N/5):
   if start+5 > N:
     end = N
     end = start+5
   print >> savefile, IL[start : end]

But this is actually more verbose, and once you get into NumPy
workflow, it is actually simple.

More information about the NumPy-Discussion mailing list