re quiz

David C. Ullrich dullrich at sprynet.com
Thu Jun 12 16:21:01 CEST 2008


On 12 Jun 2008 12:32:13 GMT, Duncan Booth
<duncan.booth at invalid.invalid> wrote:

>David C. Ullrich <dullrich at sprynet.com> wrote:
>
>> Practical question: What's a _complete_ list of the
>> escapes included in the "and so forth" in (**)?
>> 
>> (Or is there a function somewhere that will convert
>> r"\remark{Hint}" to r"\\remark{Hint}" for me, and
>> do the same for precisely the escpapes referred to
>> in the "and so forth"?)
>> 
>
>As the documentation says:
>
>Character escapes
>Numbered Groups: \0 \1 \2 \3 ...
>Named groups: \g<name>
>Numbered groups with explicit termination of the number: \g<0> \g<1> ...

Right - I was wondering about a complete list of character
escapes.

>But it doesn't matter what the complete list is. All of the escapes start 
>with \ so doubling all the \\ will prevent any of them being interpreted as 
>special so if you aren't wanting to substitute any groups into the string 
>just try repl.replace('\\', r'\\')

Good point.

David C. Ullrich



More information about the Python-list mailing list