re quiz

Duncan Booth duncan.booth at invalid.invalid
Thu Jun 12 08:32:13 EDT 2008


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> ...

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'\\')


-- 
Duncan Booth http://kupuguy.blogspot.com



More information about the Python-list mailing list