What other characters need to be escaped in a string?


#1

Question

What other characters need to be escaped in a string?

Answer

You’ll typically discover these as you code and realize your output looks odd, but some common ones are:
\\, which will display the backslash
\t, which displays a tab-length spacing
\n, which displays a new line
and \' and \", which display the single and double quotes


FAQ: Learn Python – Strings & Console Output – Escaping characters