I'm sure there's a good reason!

Emile van Sebille emile at fenx.com
Wed Mar 21 17:21:00 EST 2001


You aren't allowed to end a raw string with an odd number of \'s.

Emile van Sebille
emile at fenx.com

"Tim Rowe" <digitig at cix.co.uk> wrote in message
news:memo.20010321220225.57471D at digitig.compulink.co.uk...
> Can any of the assembled experts explain to me why:
> print r"\hello"
> is fine, but
> print r"hello\"
> isn't? In other words, why does the backslash escape quotes in a raw
> string? At one level I'm going to guess (without reading the spec) that
> it's because "that's what the spec says", but why? I thought the idea of
> raw strings was that they /didn't/ handle escapes!
>
> TIA,
>
> Tim
>





More information about the Python-list mailing list