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 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 character. > > >>> r'I can\'t end strings with a \'' > "I can\\'t end strings with a \\'" > > hth > jw > > On 10/26/05, Joshua Ginsberg <[EMAIL PROTECTED]> wrote: > > >>> r'\' > > File "<stdin>", 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 > > > -- http://mail.python.org/mailman/listinfo/python-list