"\n"
is a so-called “escape sequence.” An escape sequence is a string
character written as a backslash followed by a code, which can be one or
multiple characters. Python interprets escape sequences in a string as a
special character.
Besides the newline character "\n"
, in the chapter with titel “Expressions”
I also introduced the special characters "\'"
and "\""
, which can be
used to place a single respectively double quote in a string, regardless
of what characters surround the string. I also mentioned that you can
use "\\"
to insert a “real” backslash in a string.
Besides these, there are a few more escape sequences which lead to a
special character. Most of these are archaic and you do not need to
worry about them. The one I want to mention is "\t"
which represents
a single tabulation.