Python: String Escape Sequence
A String Escape Sequence is a special character sequence inside String to represent a character.
For example, \n
means linebreak.
# \n means linebreak x = "A\nB" print(x) # A # B
Here's complete list of escape sequence:
\'
- Single quote
\"
- Double quote
\\
- Backslash
\a
- ASCII Bell.
\b
- ASCII Backspace
\f
- ASCII Formfeed
\n
- ASCII Linefeed
\r
- ASCII Carriage Return
\t
- ASCII Horizontal Tab
\ooo
- ASCII Character ID in 3 octal digits.
\xhh
- ASCII Character ID in 2 Hexadecimal digits.
\uxxxx
- Character with Unicode Codepoint in 4 Hexadecimal digits. [see Python: Unicode Escape Sequence]
\Uxxxxxxxx
- Character with Unicode Codepoint in 6 Hexadecimal digits. [see Python: Unicode Escape Sequence]
\v
- ASCII Vertical Tab
\N{name}
- Unicode character named name. [see Unicode Basics: Character Set, Encoding, UTF-8, Codepoint]