am I stupid

Bruce Wolk bawolk at ucdavis.edu
Sun May 28 00:04:18 CEST 2000


Raw strings cannot end in a single backslash.

John Carter wrote:

> Or,
>
> How do I put a backslash as the last character in a raw string.
>
> See the text below, cut from idle,
>
> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> IDLE 0.5 -- press F1 for help
>  >>> a='hello\\'
>  >>> print a
> hello\
>  >>> a=r'helo\'
> SyntaxError: invalid token
>  >>> a=r'hello\\'
>  >>> print a
> hello\\
>  >>>
>
> Note the line before SynaxError
>
> John Carter
> jnc at ecs.soton.ac.uk




More information about the Python-list mailing list