[Python-ideas] strtr? (was startsin ?

Masklinn masklinn at masklinn.net
Sat Oct 1 15:24:21 CEST 2011


On 2011-10-01, at 13:28 , Jan Kaliszewski wrote:
> For this particular case I'd use .decode('string_escape') for Py2.x str
> and .decode('unicode_escape') for Py2.x unicode strings.
> 
> And in Py3.x I'd use... Er... In Py3.x the planned mechanism of
> str.transform()/untransform() (here: untransform('unicode_escape'))
> would be ideal -- but it has not been re-introduced yet:
> http://bugs.python.org/issue7475 -- and IMHO it should be as a clear way
> to do such transformations.
If push comes to shove, re.sub with a replacement function.



More information about the Python-ideas mailing list