summaryrefslogtreecommitdiff
path: root/Doc/library/string.rst
diff options
context:
space:
mode:
Diffstat (limited to 'Doc/library/string.rst')
-rw-r--r--Doc/library/string.rst19
1 files changed, 10 insertions, 9 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst
index 81a01fde50..e5bab684df 100644
--- a/Doc/library/string.rst
+++ b/Doc/library/string.rst
@@ -10,7 +10,7 @@
.. seealso::
- :ref:`typesseq`
+ :ref:`textseq`
:ref:`string-methods`
@@ -293,18 +293,18 @@ The general form of a *standard format specifier* is:
.. productionlist:: sf
format_spec: [[`fill`]`align`][`sign`][#][0][`width`][,][.`precision`][`type`]
- fill: <a character other than '{' or '}'>
+ fill: <any character>
align: "<" | ">" | "=" | "^"
sign: "+" | "-" | " "
width: `integer`
precision: `integer`
type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "s" | "x" | "X" | "%"
-The *fill* character can be any character other than '{' or '}'. The presence
-of a fill character is signaled by the character following it, which must be
-one of the alignment options. If the second character of *format_spec* is not
-a valid alignment option, then it is assumed that both the fill character and
-the alignment option are absent.
+If a valid *align* value is specified, it can be preceded by a *fill*
+character that can be any character and defaults to a space if omitted.
+Note that it is not possible to use ``{`` and ``}`` as *fill* char while
+using the :meth:`str.format` method; this limitation however doesn't
+affect the :func:`format` function.
The meaning of the various alignment options is as follows:
@@ -432,12 +432,13 @@ The available presentation types for floating point and decimal values are:
+=========+==========================================================+
| ``'e'`` | Exponent notation. Prints the number in scientific |
| | notation using the letter 'e' to indicate the exponent. |
+ | | The default precision is ``6``. |
+---------+----------------------------------------------------------+
| ``'E'`` | Exponent notation. Same as ``'e'`` except it uses an |
| | upper case 'E' as the separator character. |
+---------+----------------------------------------------------------+
| ``'f'`` | Fixed point. Displays the number as a fixed-point |
- | | number. |
+ | | number. The default precision is ``6``. |
+---------+----------------------------------------------------------+
| ``'F'`` | Fixed point. Same as ``'f'``, but converts ``nan`` to |
| | ``NAN`` and ``inf`` to ``INF``. |
@@ -464,7 +465,7 @@ The available presentation types for floating point and decimal values are:
| | the precision. |
| | |
| | A precision of ``0`` is treated as equivalent to a |
- | | precision of ``1``. |
+ | | precision of ``1``. The default precision is ``6``. |
+---------+----------------------------------------------------------+
| ``'G'`` | General format. Same as ``'g'`` except switches to |
| | ``'E'`` if the number gets too large. The |