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

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World