doubling slashes in a string

Fredrik Lundh effbot at telia.com
Mon Oct 9 11:36:06 EDT 2000


Alex wrote:
> Whoops!  You're right.  I had never noticed this lexical peculiarity,
> and now I wonder about the rationale for it -- since backslashes play
> no special role within a rawstring, why the peculiarly specific prohibition
> about having an odd number of them _at the end_...?

    http://www.python.org/doc/FAQ.html#6.29
    Why can't raw strings (r-strings) end with a backslash?

(implementation note: r-string literals are parsed as ordinary string
literals, but the escape codes are stored as is)

</F>




More information about the Python-list mailing list