8:9d27d58afcbb
Anton Shestakov <engored@ya.ru>, Mon, 15 Sep 2014 20:51:49 +0900
Redo formatting sections, add .format().

next change 9:738beeb055bc
previous change 3:b876b898560b

python.rst

Permissions: -rw-r--r--

Other formats: Feeds:
Column 1
========
Common Format Presentation
--------------------------
``d``
signed integer decimal
``o``
signed octal value
``x`` ``X``
signed hexadecimal *lowercase*, *uppercase*
``e`` ``E``
floating point exponential format *lowercase*, *uppercase*
``f`` ``F``
floating point decimal format
``g`` ``G``
floating point format, decimal or *lowercase*, *uppercase* exponential
``c``
single character (accepts integer or single character string)
``s``
string
Format Presentation for %
-------------------------
``i``
same as ``d``
``r``
same as ``s``, but converts any object using ``repr()``
Format Presentation for .format()
---------------------------------
``b``
binary
``n``
``d`` or ``g`` with locale-specific characters
``%``
percentage, like ``f``, but multiplies the number by 100 and adds a percent
sign
Formatting with .format()
-------------------------
``"{"[field_name]["!"conversion][":"format_spec]"}"``
format_spec: ``[[fill]align][sign]["#"]["0"][width][","]["."precision][type]``
``<``
align to left (default for most objects)
``>``
align to right (default for numbers)
``=``
padding between sign and digits (``+000000120``, valid only for numbers)
``^``
align to center
``+``
``+5`` ``-5``
``-``
``5`` ``-5`` (default)
``␣``
(a space) ``␣5`` ``-5``
``#``
``0b`` ``0o`` ``0x``
``0``
sign-aware zero-padding for numeric types (like ``{:0=}``)
``,``
comma as thousands sparator (l10n: use ``n``)
Column 2
========
re Extensions
-------------
.. raw:: html
<div style="max-width: 600px;">
``(?iLmsux)``
the group matches the empty string; the letters set the corresponding flags
``(?:...)``
a non-capturing version of regular parentheses
``(?P<name>...)``
the substring matched by the group is accessible via the symbolic group
name
``(?P=name)``
matches whatever text was matched by the earlier named group named
(backreference)
``(?#...)``
the contents of the parentheses are simply ignored
``(?=...)``
lookahead assertion: matches next, but doesn't consume any of the string
``(?!...)``
negative lookahead assertion
``(?<=...)``
lookbehind assertion: matches a preceding string
``(?<!...)``
negative lookbehind assertion, patterns which start with it may match at
the beginning of the string being searched
.. break the list
``(?(id/name)yes-pattern|no-pattern)``
sorcery. ``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>)``
.. raw:: html
</div>