“EOL while scanning single-quoted string”? (backslash in string) [duplicate]

The backslash character is interpreted as an escape. Use double backslashes for windows paths:

>>> xp1 = "\\Documents and Settings\\"
>>> xp1
'\\Documents and Settings\\'
>>> print xp1
\Documents and Settings\
>>> 

Leave a Comment