Consider the following Python 2.7 code:
print "\\"
Expected result: \\
Actual result: \
Why does Python only print out a single backslash?
Consider the following Python 2.7 code:
print "\\"
Expected result: \\
Actual result: \
Why does Python only print out a single backslash?
It's because \
is the escape character, it escape sequences like newlines and carriage returns. To print out two you can do:
print "\\\\"
Or:
print r"\\"
r
prefix tells to ignore escape characters.