[Tutor] Nesting lists?
Francois Granger
francois.granger@free.fr
Fri Apr 25 09:46:03 2003
At 20:46 +0200 24/04/2003, in message [Tutor] Nesting lists?, Wayne
Koorts wrote:
>Hi,
>
>I'd like to have 'an array of arrays'. Yes, yes I know it's not an
>array in python but a list. What I'd like to do is something to the
>effect of:
>
>data = [data1[], data2[], data3[]]
>
>but that just gives me an error. I thought of maybe using a dictionary?
>>> data1 = ['a']
>>> data2 = ['b']
>>> data3 = ['c']
>>> data = []
>>> data.append(data1)
>>> data.append(data2)
>>> data.append(data3)
>>> data
[['a'], ['b'], ['c']]
--
Hofstadter's Law :
It always takes longer than you expect, even when you take into
account Hofstadter's Law.