multiple replaces

D H no at spam
Fri Sep 16 16:33:31 CEST 2005

You can use python's re.sub function.  But also look into full fledged 
template engines like Cheetah.

import re

<p>the machine with bing</p>
<p>10% of boo is foo</p>

h3 = re.sub("<!--(\w+)-->", "%(\\1)s", h1)

house="something awfull"
tree="something beautifull"
print h3 % locals()

More information about the Python-list mailing list