Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44882

formatted output

Newsgroups comp.lang.python
Date 2013-05-07 05:00 -0700
Message-ID <add22437-64a4-4dfb-b6d9-28832e7698b4@googlegroups.com> (permalink)
Subject formatted output
From Sudheer Joseph <sjo.india@gmail.com>

Show all headers | View raw


Dear members,
            I need to print few arrays in a tabular form for example below array IL has 25 elements, is there an easy way to print this as 5x5 comma separated table? in python

IL=[]
for i in np.arange(1,bno+1):
       IL.append(i)
print(IL)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
in fortran I could do it as below
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
integer matrix(5,5)
       in=0
      do, k=1,5
      do, l=1,5
       in=in+1
      matrix(k,l)=in
      enddo
      enddo
      m=5
      n=5
      do, i=1,m
      write(*,"(5i5)") ( matrix(i,j), j=1,n )
      enddo
      end
 

Back to comp.lang.python | Previous | NextNext in thread | Find similar | Unroll thread


Thread

formatted output Sudheer Joseph <sjo.india@gmail.com> - 2013-05-07 05:00 -0700
  Re: formatted output Roy Smith <roy@panix.com> - 2013-05-07 08:42 -0400
    Re: formatted output Peter Otten <__peter__@web.de> - 2013-05-07 15:28 +0200

csiph-web