Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
ValueError: invalid \x escape
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="J. Cliff Dyer, post: 3121688"] You have two errors in your code. The first is that you didn't close your quotes. However, that wouldn't cause a value error, so you probably introduced that one in your email. The other is that you haven't escaped your backslashes. Python, unlike many other scripting languages, does not distinguish between single and double quotes (except insofar as there may be single or double quotes within the string, of course), so python sees a \P, a \L a \s, and a \m in your string. There are two ways to solve this: 1) Use a raw string: r'D:\Python24\Lib' 2) Escape your backslashes: 'D:\\Python24\\Lib' I assume the real value of 'mycode' has an x immediately after a \, right? Cheers, Cliff P.S. I just got my crystal ball back from the cleaners, so I can guess some of what you haven't told us, but in the future, make sure the code you post exhibits the problem you see. Use copy and paste instead of retyping, and if you change the code, make sure the changed code still exhibits the same problems. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
ValueError: invalid \x escape
Top