python - SyntaxError: EOL while scanning string literal while using backslash escape -


i know noob question, new python , trying understand following:

why backslash escape work without error here:

>>> print "this \\\ string" \\ string 

but when try:

>>> print "\\\" 

i get:

syntaxerror: eol while scanning string literal 

the first backslash escapes second backslash, , third escapes double quote, fails terminate string. need either print "\\\\" or print "\\\"", depending on output trying get. (the first print \\ , second print \".)


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -