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
Post a Comment