[Python-ideas] More user-friendly version for string.translate()
Chris Barker
chris.barker at noaa.gov
Wed Oct 26 21:55:13 EDT 2016
On Wed, Oct 26, 2016 at 3:48 PM, MRAB <python at 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!
-CHB
--
Christopher Barker, Ph.D.
Oceanographer
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
Chris.Barker at noaa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20161026/300c9b9d/attachment.html>
More information about the Python-ideas
mailing list