
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Escape Characters in Python
Following table is a list of escape or non-printable characters that can be represented with backslash notation.
An escape character gets interpreted; in a single quoted as well as double quoted strings.
Backslash notation | Hexadecimal character | Description |
---|---|---|
\a | 0x07 | Bell or alert |
\b | 0x08 | Backspace |
\cx | Control-x | |
\C-x | Control-x | |
\e | 0x1b | Escape |
\f | 0x0c | Formfeed |
\M-\C-x | Meta-Control-x | |
\n | 0x0a | Newline |
\nnn | Octal notation, where n is in the range 0.7 | |
\r | 0x0d | Carriage return |
\s | 0x20 | Space |
\t | 0x09 | Tab |
\v | 0x0b | Vertical tab |
\x | Character x | |
\xnn | Hexadecimal notation, where n is in the range 0.9, a.f, or A.F |
- Related Articles
- Ways to print escape characters in python
- Escape characters in JavaScript
- How to escape all special characters for regex in Python?
- Ways to print escape characters in C#
- How can we escape special characters in MySQL statement?
- Golang Program to demonstrate the escape sequence characters
- List down a list of the escape characters in C#
- How to escape characters that can be interpreted as XML markup in JSP?
- Escape a Large Maze Python
- How to process escape sequences in a string in Python?
- How to escape any special character in Python regular expression?
- Minimum number of moves to escape maze matrix in Python
- Escape sequences in Java
- Escape sequences in C
- How do I un-escape a backslash-escaped string in Python?

Advertisements