I have the folowing code:
c=2
e=3
s=12
code.append('funtion (c, e,s)')
print \n.join(code) + '\n'
The problem is when i call append.
The variables s, c, e are not replaced with their value, so in the end
i get the result:
funtion( c, e, s);
The result that i want is :
funtion(2,3,12);
Groleo Marius wrote:
I have the folowing code:
c=2
e=3
s=12
code.append('funtion (c, e,s)')
print \n.join(code) + '\n'
The problem is when i call append.
The variables s, c, e are not replaced with their value, so in the end
i get the result:
funtion( c, e, s);
The result that i want is :
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'