List of escape sequences available in Python 3.
| Escape Sequence | Description | Example |
|---|---|---|
\newline | Backslash and newline ignored | RESULT line1 line2 line3 |
\\ | Backslash (\) | RESULT \ |
\' | Single quote (') | RESULT ' |
\" | Double quote (") | RESULT " |
\a | ASCII Bell (BEL) | |
\b | ASCII Backspace (BS) | RESULT Hello World! |
\f | ASCII Formfeed (FF) | RESULT Hello World! |
\n | ASCII Linefeed (LF) | RESULT Hello World! |
\r | ASCII Carriage Return (CR) | RESULT Hello World! |
\t | ASCII Horizontal Tab (TAB) | RESULT Hello World! |
\v | ASCII Vertical Tab (VT) | RESULT Hello World! |
\ooo | Character with octal value ooo | RESULT Hello World! |
\xhh | Character with hex value hh | RESULT Hello World! |
Some escape sequences are only recognized in string literals. These are:
| Escape Sequence | Description |
|---|---|
\N{name} | Character named name in the Unicode database |
\uxxxx | Character with 16-bit hex value xxxx. Exactly four hexadecimal digits are required. |
\Uxxxxxxxx | Character with 32-bit hex value xxxxxxxx. Exactly eight hexadecimal digits are required. |
Comments
Post a Comment