superpollo ha scritto:
hi.
what is the most pythonic way to substitute substrings?
eg: i want to apply:
foo --> bar
baz --> quux
quuux --> foo
so that:
fooxxxbazyyyquuux --> barxxxquuxyyyfoo
bye
i explain better:
say the subs are:
quuux --> foo
foo --> bar
baz --> quux
then i cannot apply the subs in sequence (say, .replace() in a loop),
otherwise:
fooxxxbazyyyquuux --> fooxxxbazyyyfoo --> barxxxbazyyybar -->
barxxxquuxyyybar
not as intended...
--
http://mail.python.org/mailman/listinfo/python-list