Dear Sudheer,

On 07.05.2013, at 11:14AM, Sudheer Joseph <sudheer.jos...@yahoo.com> wrote:

>             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)
> 
assuming you want this table printed to a file, savetxt does just what you 
need. In brief for your case,

np.savetxt("file.txt", IL.reshape(-1,5), fmt='%5d', delimiter=',')

should print it in the requested form; you can refer to the save txt 
documentation for further options.

HTH,
                                                Derek

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to