List of Escape Sequence in Python
Escape Character | Meaning |
---|---|
\’ | Single quote |
\” | Double quote |
\\ | backslash |
\n | New line |
\r | Carriage Return |
\t | Horizontal tab |
\b | Backspace |
\f | form feed |
\v | vertical tab |
\0 | Null character |
\N{name} | Unicode Character Database named Lookup |
\uxxxxxxxx | Unicode Character with 16-bit hex value XXXX |
\Uxxxxxxxx | Unicode Character with 32-bit hex value XXXXXXXX |
\ooo | Character with octal value OOO |
\xhh | Character with hex value HH |
The above table is applicable to Python programming language, as different languages have different control sequences and control characters so the above table may not work in your programming language of choice. Ex. Windows Command Line interpreter uses a caret ( ^ ) to escape characters, and therefore the above table won’t be applicable there.
Preventing Escape Sequence Interpretation in Python
Python Escape Sequence is a combination of characters (usually prefixed with an escape character), that has a non-literal character interpretation such that, the character’s sequences which are considered as an escape sequence have a meaning other than the literal characters contained therein. Most Programming languages use a backslash \ as an escape character. This character is used as an escape sequence initiator, any character (one or more) following this is interpreted as an escape sequence. If an escape sequence is designated to a Non-Printable Character or a Control Code, then the sequence is called a control character.
Contact Us