How to have a list of lists (or array of lists)

7stud bbxx789_05ss at yahoo.com
Tue Apr 3 20:06:47 CEST 2007


On Apr 3, 10:12 am, "bahoo" <b83503... at yahoo.com> wrote:
> Hi,
>
> I want to have many lists, such as list0, list1, list2, ..., each one
> holding different number of items.
> Is there something like
> list[0]
> list[1]
> list[2]
>
> so that I can iterate through this list of lists?
>
> Thanks!
> bahoo

list0 = [1]
list1 = [2,3,4,5]
list2 = [6,7,8]

allLists = [list0, list1, list2]
print allLists[1][3]
print allLists[0][0]




More information about the Python-list mailing list