Creating a matrix?

Peter Maas peter.maas at mplusr.de
Fri Apr 2 10:25:06 EST 2004


Ivan Voras wrote:
> Is there a nice(r) way of creating a list of uniform values? I'm 
> currently using: list('0'*N), which makes a string and then chops it up 
> into a list. I need it to create a NxN matrix:
> 
 > matrix = [list('0'*N) for i in range(N)]

matrix = [['0']*N]*N

Mit freundlichen Gruessen,

Peter Maas

-- 
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Hubert-Wienen-Str. 24
Tel +49-241-93878-0 Fax +49-241-93878-20 eMail peter.maas at mplusr.de
-------------------------------------------------------------------



More information about the Python-list mailing list