Python: String Escape Sequence
What is 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
List of Escape Sequence
\'
- APOSTROPHE
\"
- 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: Character Set, Encoding, UTF-8, Codepoint〕
Python, String
- Python: Quote String
- Python: Triple Quote String
- Python: Raw String
- Python: String Prefix Char
- Python: f-String (Format, Template)
- Python: String Escape Sequence
- Python: Unicode Escape Sequence
- Python: Print String
- Python: Print Without Newline
- Python: Convert to String
- Python: Join String
- Python: Format String
- Python: String Methods
- Python: Search Substring
- Python: Split String
- Python: String, Check Case, Char Class
- Python: Letter Case Conversion
- Python: Unicode 🐍
- Python 2: Unicode Tutorial