Using a string variable as a variable name

Viewed 391711

Possible Duplicate:
How do I do variable variables in Python?

I have a variable with a string assigned to it and I want to define a new variable based on that string.

foo = "bar"
foo = "something else"   

# What I actually want is:

bar = "something else"
3 Answers
Related