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\
>>>
More Related Contents:
- parser =3D syntax error [closed]
- Invalid syntax when trying to run python script [closed]
- (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape [duplicate]
- f-strings giving SyntaxError?
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- Python cannot handle numbers string starting with 0. Why?
- SyntaxError: multiple statements found while compiling a single statement
- syntax error when using command line in python
- Python print statement “Syntax Error: invalid syntax” [duplicate]
- How to solve SyntaxError on autogenerated manage.py?
- Why can’t attribute names be Python keywords?
- Error “(unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape” [duplicate]
- Why doesn’t 2.__add__(3) work in Python?
- Why do I get the syntax error “SyntaxError: invalid syntax” in a line with perfectly valid syntax?
- Why am I getting “invalid syntax” from an f-string? [duplicate]
- Ampersand “&” syntax error running any Python script in VSCode?
- Why do parentheses in a lambda function cause syntax error on Python 3? [duplicate]
- Why does the IPython REPL tell me “SyntaxError: unexpected EOF while parsing” as I input the code?
- Invalid Syntax error when running python from inside Visual Studio Code
- Python: SyntaxError: keyword can’t be an expression
- Capture makes remaining patterns unreachable
- How to fix syntax error when printing a string with an apostrophe in it? [closed]
- Invalid syntax using dict comprehension
- Relative imports for the billionth time
- How to install 2 Anacondas (Python 2 and 3) on Mac OS
- Jupyter | The kernel appears to have died. It will restart automatically |
- tkinter optionmenu first option vanishes
- Spyder IDE Console History
- Trouble Installing Pygame on Mac OSX
- Pygame: Collision by Sides of Sprite