[Tutor] Multidimensional arrays
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Tue May 18 13:06:56 EDT 2004
On Tue, 18 May 2004, Prospero wrote:
> I am sure I am missing something obvious here but I cannot see how to
> set up a two-dimensional array. I am hoping it can be done using lists
> of lists, as it were, which would suit my current program as I have
> written it so far. Any help would be much appreciated.
Hi Prospero,
Making a two-dimensional list is not immediately obviously --- but that's
why there's a FAQ entry about it:
http://python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list
*grin*
You're right: the general approach is to use a list of lists. The only
thing to be careful about is making sure each individual sublist is
separate from the others.
Hope this helps!
More information about the Tutor
mailing list