String changing on the fly

Eli Daniel elie at flashmail.com
Wed Oct 20 18:48:14 CEST 2004


Hi,

I'm new to Python. Can you please tell me if the following is
possible.

My users are using other scripting launguage to write scripts. They
are used to write somthing like (keeping it simple)
T = 100
do_action ('It cost $T dollars')

where the above syntax ('It cost $T dollars') is interperted as ('It
cost 100 dollars').
I saw on way of doing it by using 'it cost '+ str(T) + ' dollars'.
But trying to keep it backward compatible, is there a way for the
function do_action, which resides in a class in a seperate file, to
take the original string (with the '$T') and replace it with the value
of T?

cheers



More information about the Python-list mailing list