Variable names on the fly?

e-tones.co.uk admin at e-tones.co.uk
Thu Nov 14 14:13:22 EST 2002


Hi all, does python allow the creation of variable names on the fly, more
importantly lists.

I have a stock list containing 5 elements, [0,0,0,0,0]

Lets call it: list

Now, via a loop, can I create list1, list2, list3 on the fly by replicting
the original list, eg

i = 1
for i in range(2)
    list+i = list

Whats the proper format to concatenate (sp?) variable names. I used list+i,
obviously this doesnt work, but what does :)

Cheers
Taz








More information about the Python-list mailing list