The Python string supports a simple but powerful output format that formats the output string in several ways:
1, the specified number of decimal digits for the floating-point value
2, using exponential (scientific) notation to represent floating-point numbers
3, align the decimal point of a column of numbers
4, make the output right or left justified
5, inserts a character or string at the specified position in a line of output
6, display all types of data with fixed field width and precision
| Conversion indicator Symbol |
Meaning |
| C |
A single character (that is, a string of length 1), or an integer representation of an ASCII character |
| S |
String, or a value to convert to a string |
| D |
A value with a signed (positive negative number) |
| U |
unsigned decimal integers |
| O |
unsigned octal integer |
| X |
unsigned hexadecimal integers (digits A through F are taken in lowercase) |
| X |
unsigned hexadecimal integers (digits A through F are taken in lowercase) |
| F |
Floating point number |
| E,e |
Floating-point numbers (using scientific notation) |
| G,g |
Floating-point number (with the lowest bit significant digits) |
end!
string formatting of Python