summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorEric Smith <eric@trueblade.com>2008-07-16 00:15:35 (GMT)
committerEric Smith <eric@trueblade.com>2008-07-16 00:15:35 (GMT)
commitd68af8f7431790ac6b74887ccd2a1dcdbae3bdeb (patch)
treeb3fbd7875e9595178f35f0352cdcb72a8c46f802 /Doc
parentf70e195927d475b6cc522f8c9ee51f5db97f7e0c (diff)
downloadcpython-d68af8f7431790ac6b74887ccd2a1dcdbae3bdeb.zip
cpython-d68af8f7431790ac6b74887ccd2a1dcdbae3bdeb.tar.gz
cpython-d68af8f7431790ac6b74887ccd2a1dcdbae3bdeb.tar.bz2
Merged revisions 64984 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r64984 | eric.smith | 2008-07-15 20:11:49 -0400 (Tue, 15 Jul 2008) | 1 line Complete issue 3083: add alternate (#) formatting to bin, oct, hex in str.format(). ........
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/string.rst8
1 files changed, 6 insertions, 2 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 668a530..662541e 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -294,7 +294,7 @@ result as if you had called :func:`str` on the value.
The general form of a *standard format specifier* is:
.. productionlist:: sf
- format_spec: [[`fill`]`align`][`sign`][0][`width`][.`precision`][`type`]
+ format_spec: [[`fill`]`align`][`sign`][#][0][`width`][.`precision`][`type`]
fill: <a character other than '}'>
align: "<" | ">" | "=" | "^"
sign: "+" | "-" | " "
@@ -348,6 +348,10 @@ following:
| | positive numbers, and a minus sign on negative numbers. |
+---------+----------------------------------------------------------+
+The ``'#'`` option is only valid for integers, and only for binary,
+octal, or decimal output. If present, it specifies that the output
+will be prefixed by ``'0b'``, ``'0o'``, or ``'0x'``, respectively.
+
*width* is a decimal integer defining the minimum field width. If not
specified, then the field width will be determined by the content.
@@ -368,7 +372,7 @@ The available integer presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
- | ``'b'`` | Binary. Outputs the number in base 2. |
+ | ``'b'`` | Binary format. Outputs the number in base 2. |
+---------+----------------------------------------------------------+
| ``'c'`` | Character. Converts the integer to the corresponding |
| | unicode character before printing. |