
James G. answered 05/16/18
Tutor
4.9
(1,012)
Tutor
Part of the reason is the difference between how
The backslash is used to change the meaning of the character it preceded. It only does this for certain characters.
The "\\\ " does not turn into "\\\\ " it is actually "\\ ". To see the difference try the following.
>>>a = "\\\ "
>>>a
"\\\\ "
>>>print(a)
\\
What happened?
The '\' is a character that can be escaped. So '\\' becomes '\' .
The space character is not escaped so the '\' has nothing to do and becomes '\'.
the ">>>a" echo shows what you should type into as string to get the content in "a". It doesn't expect you to use '\' with a space so it shows "\\\\".
The "print(a)" outputs the actual content.
You also should try ">>>len(a)" to confirm witch version is the real content.