On 25 Maj, 05:29, Jim Garrison <j...@acm.org> wrote:
> And as an interesting exercise, try
>
> print r'test \'
> print r'test \\'
>
> Because of the way raw string parsing is defined, neither of these will
> pass the parser.  In fact, a raw string cannot have a backslash as
> its last character.

Tried it:
>>> r'test \'
SyntaxError: EOL while scanning string literal

>>> r'test \\'
'test \\\\'

Second one is accepted. See the language reference section 2.4.1 as of
why; 
http://www.python.org/doc/current/reference/lexical_analysis.html?highlight=raw%20strings#string-literals

/Niklas Norrthon
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to