executea string
Cyril BAZIN
cyril.bazin at gmail.com
Tue Feb 22 08:50:22 EST 2005
> > c=2
> > e=3
> > s="12"
> > code.append('funtion ("c, e,s")')
> > print "\n".join(code) + '\n'
> >
Hello,
You could try this:
-----------------------
from string import Template
code = ""
c=2
e=3
s="12"
code.append(Template('function ("$c, $e, $s")').substitute(vars()))
print "\n".join(code) + '\n'
------------------------
For more informations about templates, see:
http://docs.python.org/lib/node105.html
Note that is new in version 2.4...
Cyril
More information about the Python-list
mailing list