Python format substitution and meaning of the string
| Symbol |
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 the precision after a decimal point |
| %e |
Format floating-point numbers with scientific notation |
| %E |
function with%e, format floating-point numbers with scientific notation |
| %g |
Depending on the size of the value, use%f live%e |
| %G |
function with%g, depending on the size of the value to use%f live%e |
| %p |
Format the address of a variable with hexadecimal number |
Python's escape character and its meaning
| Symbol |
Description |
| \‘ |
Single quotation marks |
| \" |
Double quotes |
| \a |
Issue System ring tones |
| \b |
Backspace |
| \ n |
Line break |
| \ t |
Horizontal tab |
| \v |
Portrait tab |
| \ r |
Carriage return character |
| \f |
Page break |
| \o |
Characters represented by octal numbers |
| \x |
The hexadecimal number represents the character |
| \000 |
Terminator, the string after \000 is all ignored |
If you output "\" In a string, use "\ \"
This article from "Saab √ Martini" blog, declined reprint!
Python escape character