formatted output

Sudheer Joseph sjo.india at gmail.com
Tue May 7 08:00:21 EDT 2013


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
 



More information about the Python-list mailing list