[Python] Variable variables?
Rob Hudson
rob at euglug.net
Sat Mar 17 21:02:26 PDT 2007
Every now and then I hit a need for what's called "variable variables"
in the PHP world. Here's what usually happens:
Let's say I have 3 lists: list1, list2, list3
And I want to write a loop to do something to each list. I want to do
something like this:
for i in range(3):
myloop = "loop" + str(i)
# Do something to myloop, but myloop the interpretted
# variable, not myloop the string
1) Can python do this?
2) Is there a better way to handle this same idea another way?
Thanks,
Rob
More information about the Python
mailing list