String handling bug in Python
Bjorn Pettersen
BPettersen at NAREX.com
Fri Apr 26 17:23:49 EDT 2002
> From: Tim Peters [mailto:tim.one at comcast.net]
>
> [Stephen Ferg]
> > ...
> > I would like to see Python support TRULY raw string
> literals -- string
> > literals that are not escaped in any way. Perhaps they
> could be added
> > with a prefix of z (for zero escaping?), so that
> >
> > z"\" == "\\"
> > z"\'" == "\\\'"
>
> The first one can't be spelled at all with a raw string
> today. The second one can be, and indeed the same way you
> spelled it, as r"\'". What do you do in your scheme if you
> want a z-string to contain a single double-quote?
I always thought that could be spelled r'"' or r'''"''', but I guess
there would still be a problem if you wanted all of ", ', ''', and """
in a string. I would think that would occur less frequently than \ at
the end of a string though (especially with windows path names). I feel
I must be missing something?
Confused'ly y'rs
-- bjorn
More information about the Python-list
mailing list