How to make arrays from Lists

Michiel Overtoom motoom at xs4all.nl
Tue Nov 11 20:01:24 EST 2008


bearophileHUGS at lycos.com wrote:

> x = [[0] * ncols for i in nrows]

That gives an error... small typo corrected:

y = [[0] * ncols for i in range(nrows)]

Greetings,

-- 
"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



More information about the Python-list mailing list