On 26 Oct 2005 12:27:53 -0700, "Paul McGuire" <[EMAIL PROTECTED]>
wrote:
>"Raw string fu"? A new martial art?
For the udon-aware.
--dang
--
http://mail.python.org/mailman/listinfo/python-list
"Raw string fu"? A new martial art?
--
http://mail.python.org/mailman/listinfo/python-list
Joshua Ginsberg wrote:
> >>> r'\'
> File "", line 1
> r'\'
> ^
> SyntaxError: EOL while scanning single-quoted string
> >>> r'\\'
> ''
>
> Does that seem wrong to anybody else? Shouldn't the first one be
> syntactically correct?
the "r" prefix doesn't change how string literals are parsed; it
Doh. that example was supposed to be ->
>>> r'I can\'t end strings with a \.'
"I can\\'t end strings with a \\."
On 10/26/05, Jaime Wyant <[EMAIL PROTECTED]> wrote:
> This URL has a good section on raw strings.
>
> http://www.ferg.org/projects/python_gotchas.html
>
> r'\' is wrong because raw stri
This URL has a good section on raw strings.
http://www.ferg.org/projects/python_gotchas.html
r'\' is wrong because raw strings were originally added to make
regular expressions easier to write. And you can't have a regexp that
ends with \.
Also, you can use the \ to escape your original quote c
>>> r'\'
File "", line 1
r'\'
^
SyntaxError: EOL while scanning single-quoted string
>>> r'\\'
''
Does that seem wrong to anybody else? Shouldn't the first one be
syntactically correct?
-jag
--
http://mail.python.org/mailman/listinfo/python-list