diff options
author | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2009-01-03 21:18:54 (GMT) |
commit | 48310cd3f2e02ced9ae836ccbcb67e9af3097d62 (patch) | |
tree | 04c86b387c11bfd4835a320e76bbb2ee24626e0d /Doc/library/string.rst | |
parent | 3d3558a4653fcfcbdcbb75bda5d61e93c48f4d51 (diff) | |
download | cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.zip cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.gz cpython-48310cd3f2e02ced9ae836ccbcb67e9af3097d62.tar.bz2 |
Remove trailing whitespace.
Diffstat (limited to 'Doc/library/string.rst')
-rw-r--r-- | Doc/library/string.rst | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/Doc/library/string.rst b/Doc/library/string.rst index 37704b0..98c7051 100644 --- a/Doc/library/string.rst +++ b/Doc/library/string.rst @@ -98,7 +98,7 @@ implementation as the built-in :meth:`format` method. :meth:`format` is just a wrapper that calls :meth:`vformat`. .. method:: vformat(format_string, args, kwargs) - + This function does the actual work of formatting. It is exposed as a separate function for cases where you want to pass in a predefined dictionary of arguments, rather than unpacking and repacking the @@ -111,12 +111,12 @@ implementation as the built-in :meth:`format` method. intended to be replaced by subclasses: .. method:: parse(format_string) - + Loop over the format_string and return an iterable of tuples (*literal_text*, *field_name*, *format_spec*, *conversion*). This is used by :meth:`vformat` to break the string in to either literal text, or replacement fields. - + The values in the tuple conceptually represent a span of literal text followed by a single replacement field. If there is no literal text (which can happen if two replacement fields occur consecutively), then @@ -134,7 +134,7 @@ implementation as the built-in :meth:`format` method. *key* parameter to :meth:`get_value`. .. method:: get_value(key, args, kwargs) - + Retrieve a given field value. The *key* argument will be either an integer or a string. If it is an integer, it represents the index of the positional argument in *args*; if it is a string, then it represents a @@ -172,7 +172,7 @@ implementation as the built-in :meth:`format` method. method is provided so that subclasses can override it. .. method:: convert_field(value, conversion) - + Converts the value (returned by :meth:`get_field`) given a conversion type (as in the tuple returned by the :meth:`parse` method.) The default version understands 'r' (repr) and 's' (str) conversion types. @@ -201,7 +201,7 @@ The grammar for a replacement field is as follows: element_index: `integer` conversion: "r" | "s" | "a" format_spec: <described in the next section> - + In less formal terms, the replacement field starts with a *field_name*, which can either be a number (for a positional argument), or an identifier (for keyword arguments). Following this is an optional *conversion* field, which is @@ -221,7 +221,7 @@ Some simple format string examples:: "My quest is {name}" # References keyword argument 'name' "Weight in tons {0.weight}" # 'weight' attribute of first positional arg "Units destroyed: {players[0]}" # First element of keyword argument 'players'. - + The *conversion* field causes a type coercion before formatting. Normally, the job of formatting a value is done by the :meth:`__format__` method of the value itself. However, in some cases it is desirable to force a type to be formatted @@ -265,11 +265,11 @@ effectively:: Then the outer replacement field would be evaluated, producing:: "noses " - + Which is substituted into the string, yielding:: - + "A man with two noses " - + (The extra space is because we specified a field width of 10, and because left alignment is the default for strings.) @@ -301,7 +301,7 @@ The general form of a *standard format specifier* is: width: `integer` precision: `integer` type: "b" | "c" | "d" | "e" | "E" | "f" | "F" | "g" | "G" | "n" | "o" | "x" | "X" | "%" - + The *fill* character can be any character other than '}' (which signifies the end of the field). The presence of a fill character is signaled by the *next* character, which must be one of the alignment options. If the second character @@ -394,9 +394,9 @@ The available integer presentation types are: +---------+----------------------------------------------------------+ | None | The same as ``'d'``. | +---------+----------------------------------------------------------+ - + The available presentation types for floating point and decimal values are: - + +---------+----------------------------------------------------------+ | Type | Meaning | +=========+==========================================================+ |