'string_escape' in python 3
Ian Kelly
ian.g.kelly at gmail.com
Sat Apr 7 11:59:36 EDT 2012
On Sat, Apr 7, 2012 at 8:30 AM, Nicholas Cole <nicholas.cole at gmail.com> wrote:
> On Sat, Apr 7, 2012 at 12:10 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
>>>>> import codecs
>>>>> codecs.getdecoder('unicode_escape')(s)[0]
>> 'Hello: this is a test'
>>
>> Cheers,
>> Ian
>
> Thanks, Ian. I had assumed that if a unicode string didn't have a
> .decode method, then I couldn't use a decoder on it, so it hadn't
> occurred to me to try that....
Just a warning, I'm not really sure whether this behavior is intended
or not. I just tried it and found that it seems to work.
More information about the Python-list
mailing list