multiple replaces

Fredrik Lundh fredrik at pythonware.com
Fri Sep 16 13:59:35 CEST 2005


Harald Armin Massa wrote:

> sth. like
> rpdict={"<!--tree-->":"%(tree)s","<!--house-->":"%(house)s","%","%%"}
>
> for key, value in rpdict.iteritems():
>    h1=h1.replace(key, value)
>
> but ... without the garbage, in one command.
>
> I guess there are very, very, very wise solution for this problem, but
> I do not know of them.

http://effbot.org/zone/python-replace.htm

</F> 






More information about the Python-list mailing list