Added '#' alternate formatting for integers. See issue 3138.

This commit is contained in:
Eric Smith 2008-07-14 15:50:26 +00:00
parent 618b33c9e8
commit 3722b933b5
1 changed files with 7 additions and 3 deletions

View File

@ -8,7 +8,7 @@ Type: Standards Track
Content-Type: text/plain Content-Type: text/plain
Created: 16-Apr-2006 Created: 16-Apr-2006
Python-Version: 3.0 Python-Version: 3.0
Post-History: 28-Apr-2006, 6-May-2006, 10-Jun-2007, 14-Aug-2007 Post-History: 28-Apr-2006, 6-May-2006, 10-Jun-2007, 14-Aug-2007, 14-Sep-2008
Abstract Abstract
@ -240,7 +240,7 @@ Standard Format Specifiers
The general form of a standard format specifier is: The general form of a standard format specifier is:
[[fill]align][sign][0][minimumwidth][.precision][type] [[fill]align][sign][#][0][minimumwidth][.precision][type]
The brackets ([]) indicate an optional element. The brackets ([]) indicate an optional element.
@ -275,6 +275,10 @@ Standard Format Specifiers
' ' - indicates that a leading space should be used on ' ' - indicates that a leading space should be used on
positive numbers positive numbers
If the '#' character is present, integers use the 'alternate form'
for formatting. This means that binary, octal, and hexidecimal
output will be prefixed with '0b', '0o', and '0x', respectively.
'width' is a decimal integer defining the minimum field width. If 'width' is a decimal integer defining the minimum field width. If
not specified, then the field width will be determined by the not specified, then the field width will be determined by the
content. content.