A simple list question.
Kent Johnson
kent at kentsjohnson.com
Thu Dec 22 18:20:53 EST 2005
KraftDiner wrote:
> I am trying to implement a two dimensional array.
> mylist = [[a,b,c],[d,e,f,c],[g,h,i]]
>
> So the array is of length 3 here...
> So how do I initialize this array and then set each object?
> At some point in my code I know there will be 3 lists in the list.
> So how do I initialize this list such that I can access them
> as elements... like
> mylist[1] = [c,f,g]
> in random order...
If you can separate the code into a list builder and a list client, maybe the builder can
just use append and the client can use indexing.
Kent
More information about the Python-list
mailing list