Re: Equivalent of TCL's subst ?

2007-11-17 Thread gamename
foobar = HI! x = 'foo' y = 'bar' print eval(x+y) HI! Great! Thanks. -T -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of TCL's subst ?

2007-11-14 Thread Loic Mahe
gamename a écrit : 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 you can also try using eval: foobar = HI! x = 'foo' y = 'bar' print eval(x+y) HI! Loic --

Equivalent of TCL's subst ?

2007-11-13 Thread gamename
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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Equivalent of TCL's subst ?

2007-11-13 Thread Steven Bethard
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

Re: Equivalent of TCL's subst ?

2007-11-13 Thread Larry Bates
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 --