Can I get a technical explanation on the following error

Piet van Oostrum piet at cs.uu.nl
Mon May 25 16:12:22 CEST 2009


>>>>> Jim Garrison <jhg at acm.org> (JG) wrote:

>JG> And as an interesting exercise, try
>JG> print r'test \'
>JG> print r'test \\'

>JG> Because of the way raw string parsing is defined, neither of these will
>JG> pass the parser.  In fact, a raw string cannot have a backslash as
>JG> its last character.

Cannot have an odd number of backslashes as its last characters.

>>> print r'test \\'
test \\
-- 
Piet van Oostrum <piet at cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet at vanoostrum.org



More information about the Python-list mailing list