Equivalent of TCL's "subst" ?
Steven Bethard
steven.bethard at gmail.com
Tue Nov 13 18:08:26 EST 2007
More information about the Python-list mailing list
Tue Nov 13 18:08:26 EST 2007
- Previous message (by thread): Equivalent of TCL's "subst" ?
- Next message (by thread): Equivalent of TCL's "subst" ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
gamename wrote:
> 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?
If this is at the outer-most scope, you can use globals()::
>>> foobar = 'HI!'
>>> x = 'foo'
>>> y = 'bar'
>>> globals_dict = globals()
>>> globals_dict[x + y]
'HI!'
That said, why do you think you want to do this?
STeVe
- Previous message (by thread): Equivalent of TCL's "subst" ?
- Next message (by thread): Equivalent of TCL's "subst" ?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list