On Wed, Oct 26, 2016 at 3:48 PM, MRAB <python@mrabarnett.plus.com> wrote:

str.replace( ("aaa", "a", "b"), ("b", "bbb", "a")

and all sort of other complications!

2) Check from the longest to the shortest.

If you're going to pick choice 2, does it have to be 2 tuples/lists? Why not a dict instead?

then we have a string.translate() that accepts a table of string replacements, rather than individual character replacements -- maybe a good idea!



Christopher Barker, Ph.D.

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception