Escaping certain characters
jan.danielsson at gmail.com
Mon Aug 1 03:11:53 CEST 2005
Robert Kern wrote:
>> I need to escape '\n', '"', '[' and ']'. I finally went with a few of
>> string.replace('\n', '\\n')
>> string.replace('"', '\\"')
>> I assume that's good enough, but I somehow expected there to exist
>> some form of "insert your conversion table here" built-in string escaper.
> Write a codec.
Is that what string.encode() uses? Some behind-the-scenes "codec"? I
tried searching for it, but could only find UTF/Unicode-related
information. Is it in the normal python documentation?
Semi-Offtopic: The "search" facility in the Python help has stopped
functioning for me (I'm using XP on this system). No matter what I
search for, I get no results. A week ago, I got a lot of hits for almost
anything I searched for. Anyone seen this behavior, and knows what to do
Te audire no possum. Musa sapientum fixa est in aure.
More information about the Python-list