Equivalent of TCL's "subst" ?

Larry Bates larry.bates at websafe.com
Tue Nov 13 19:49:51 EST 2007


gamename wrote:
> Hi,
> 
> In TCL, you can do things like:
> set foobar "HI!"
> set x foo
> set y bar
> subst $$x$y
> HI!
> 
> Is there a way to do this type of evaluation in python?
> 
> TIA,
> -T
> 

myStore={}

myStore['foobar']="HI!"
x='foo'
y='bar'
print myStore[x+y]

-Larry



More information about the Python-list mailing list