r prefix bug ... or my lack of understanding?
James Henderson
james at logicalprogression.net
Wed Jan 28 09:39:33 EST 2004
On Wednesday 28 January 2004 2:27 pm, Bill Sneddon wrote:
> Below is from python 2.3.3 on windows.
> I have tryed on Pythonwin and Idle and on
> a Solaris unix build 2.2.2.
>
> I know there are work arounds but the behavior
> seems a bit strange to me.
>
> >>> path = r'c:\data' #this is fine
> >>> print path
>
> c:\data
>
> >>> path = r'c:\data\'
>
> Traceback ( File "<interactive input>", line 1
> path = r'c:\data\'
> ^
> SyntaxError: EOL while scanning single-quoted string
Your second backslash is escaping the closing quotation mark.
> >>> path = r'c:\data\\'
> >>> print path
>
> c:\data\\
Try this (with no "r":
>>> print 'c:\\data\\'
c:\data\
James
--
James Henderson, Logical Progression Ltd.
http://www.logicalprogression.net/
http://sourceforge.net/projects/mailmanager/
More information about the Python-list
mailing list