J
Jean-Pierre Bergamin
Hi there
I want to implement a small templating system where values in angle brackets
should be replaced by the corresponding dicitionary value ("foo {x} bar" ->
"foo 10 bar");
How can I now put the actual value of d["x"] into the string 'foo d["x"]
bar'?
Thanks for your help.
Regards
James
I want to implement a small templating system where values in angle brackets
should be replaced by the corresponding dicitionary value ("foo {x} bar" ->
"foo 10 bar");
'foo d["x"] bar'd = {}
d["x"] = 10
p = re.compile('{ ( [^}]* ) }', re.VERBOSE)
p.sub(r'd["\1"]','foo {x} bar')
How can I now put the actual value of d["x"] into the string 'foo d["x"]
bar'?
Thanks for your help.
Regards
James