Mike wrote...

>Do you happen to know if there is an efficient way to initialize a  list 
>like this without explicitly writing out each element?

>>> temp = [[0, 0, 0],[0, 0, 0],[0, 0, 0]]
>>> print temp
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]

>>> print [[0]*3]*3
[[0, 0, 0], [0, 0, 0], [0, 0, 0]]


-- 
"The ability of the OSS process to collect and harness
the collective IQ of thousands of individuals across
the Internet is simply amazing." - Vinod Vallopillil
http://www.catb.org/~esr/halloween/halloween4.html

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to