mirror of
https://github.com/python/cpython.git
synced 2025-07-23 19:25:40 +00:00
Issue #15660: Further clarify 0 prefix for width specifier in formats.
This commit is contained in:
parent
e431d3c9aa
commit
4902c46bff
1 changed files with 4 additions and 2 deletions
|
@ -327,7 +327,8 @@ The meaning of the various alignment options is as follows:
|
||||||
| ``'='`` | Forces the padding to be placed after the sign (if any) |
|
| ``'='`` | Forces the padding to be placed after the sign (if any) |
|
||||||
| | but before the digits. This is used for printing fields |
|
| | but before the digits. This is used for printing fields |
|
||||||
| | in the form '+000000120'. This alignment option is only |
|
| | in the form '+000000120'. This alignment option is only |
|
||||||
| | valid for numeric types. |
|
| | valid for numeric types. It becomes the default when '0'|
|
||||||
|
| | immediately precedes the field width. |
|
||||||
+---------+----------------------------------------------------------+
|
+---------+----------------------------------------------------------+
|
||||||
| ``'^'`` | Forces the field to be centered within the available |
|
| ``'^'`` | Forces the field to be centered within the available |
|
||||||
| | space. |
|
| | space. |
|
||||||
|
@ -376,7 +377,8 @@ instead.
|
||||||
*width* is a decimal integer defining the minimum field width. If not
|
*width* is a decimal integer defining the minimum field width. If not
|
||||||
specified, then the field width will be determined by the content.
|
specified, then the field width will be determined by the content.
|
||||||
|
|
||||||
Preceding the *width* field by a zero (``'0'``) character enables
|
When no explicit alignment is given, preceding the *width* field by a zero
|
||||||
|
(``'0'``) character enables
|
||||||
sign-aware zero-padding for numeric types. This is equivalent to a *fill*
|
sign-aware zero-padding for numeric types. This is equivalent to a *fill*
|
||||||
character of ``'0'`` with an *alignment* type of ``'='``.
|
character of ``'0'`` with an *alignment* type of ``'='``.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue