In python print("backslash \")
produces error but print("backslash \ ")
doesn't produce error.
in print(backslash \")
there is no space between \ and ".
and this produces a SyntaxError: EOL while scanning string literal
whereas if i give a space between the \ and " , then there in no error. Why?
few more examples
print(" this is double backslash \\\sad ")
the above statement doesn't produce any error, and it generates the output as:-
this is a single backslash \\sad
and I get the same output on writing this :-
print(" this is a single backslash \\\\sad ")
Here I have escape each \
separately, so this is working but why the previous one is working?