Chinese name: string formatting
Function:
- One parameter can populate multiple format characters
>>> "Hello {}". format ("LSL")
Hello LSL
{} expression grammar:
Replacement_field :: = "{" [field_name] ["!" conversion] [":" format_spec] "}"
The Field_name name descriptor, which can be a name, location, property.
Properties, which I am interested in, so that you can populate multiple formats with just one pass.
The FORMAT_SPEC format descriptor, which can be the padding + alignment number + format.
%xxx, which is basically the same as the format descriptor.
Print ("Helllo%-10s", "33")
Format: Inherits the form of D s F, which is traditional print.
Example
in []: "Hello {people.name:*>10}". Format (PEOPLE=P)
OUT[38]: ' Hello *******LSL '
Https://docs.python.org/2/library/string.html#string-formatting
Http://www.jb51.net/article/63672.htm
Python string format note