Commonly used escape characters and meanings
| Escape character |
Meaning |
| \ (at end of line) |
Line continuation character |
| \\ |
Backslash symbol |
| \‘ |
Single quotation marks |
| \" |
Double quotes |
| \a |
Bell (System issued) |
\b |
BACKSPACE (Backspace) |
| \e |
Escape |
| \000 |
Terminator, all characters after \000 are ignored |
| \ n |
Line break |
| \v |
Portrait tab |
| \ t |
Horizontal tab |
| \ r |
Carriage return character |
| \f |
Page break |
| \o |
Characters represented by octal numbers |
| \x |
The hexadecimal number represents the character |
Alternate characters and meanings of formatted strings
| Symbol |
Meaning description |
| %c |
Formatting characters and their ASCII code |
| %s |
formatting strings |
| %d |
formatting integers |
| %u |
Formatting an unsigned integer |
| %o |
Formatting an unsigned octal number |
| %x |
formatting unsigned hexadecimal numbers |
| %x |
Format unsigned hexadecimal number (uppercase) |
| %f |
Format floating-point numbers to specify post-decimal precision |
| %e |
Format floating-point numbers with scientific notation |
| %E |
With%e |
| %g |
Use%f or%e depending on the size of the value |
| %G |
With%g |
| %p |
Format the address of a variable with hexadecimal number |
Python escape character and formatting string summary