How to have a list of lists (or array of lists)
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Tue Apr 3 15:37:47 EDT 2007
bahoo a écrit :
> 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?
listoflists = [
[1, 2, 3],
["foo", "bar", "baaz", "quux"],
["A", "B", "C", "D", "E"]
]
for alist in listoflists:
for item in alist:
print item
More information about the Python-list
mailing list