Bad raw string handling, string ends with backslash

Wolfgang wl at flexis.de
Tue May 27 05:09:24 EDT 2003


Hello,

first I thought it is a bug in vim.
I wrote: xyz = r"T:\bin\bla\"
and Syntax highlighting goes wrong.

But then I discovered, that python can't handle such a case.
I thougt: "Oh, a bug in python".
But no, the Language Reference says:
r"\" is not a valid string literal (even a raw string cannot end in an 
odd number of backslashes)

But if I use raw strings explicitly, why is it not possible to do
this so.

I have to do this:

xyz = r"T:\bin\bla" + "\\"

Yeah, raw strings are very usefull and save.

So, use raw strings with care.

Sorry, know I know why they are rarely used
and wan't to know:


why this behaviour ?


bye by Wolfgang





More information about the Python-list mailing list