How to make arrays from Lists

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Sat Nov 15 01:10:30 EST 2008


En Tue, 11 Nov 2008 23:09:25 -0200, <gc_ottawa at yahoo.ca> escribió:
> On Nov 11, 7:48 pm, bearophileH... at lycos.com wrote:

>> To create a 2D list, that is a list of lists:
>> x = [[0] * ncols for i in nrows]
>
> Many thanks, I don't think I would ever 'discovered' this.

Try reading the FAQ:  
http://www.python.org/doc/faq/programming/#how-do-i-create-a-multidimensional-list

-- 
Gabriel Genellina




More information about the Python-list mailing list