Anton Shestakov <engored@ya.ru>, Sat, 04 Apr 2015 22:25:50 +0800
rst: commas for clarity when explanation has more than one meaning
Common Format Presentation -------------------------- signed hexadecimal
*lowercase*,
*uppercase* floating point exponential format
*lowercase*,
*uppercase* floating point decimal format
floating point format, decimal or
*lowercase*,
*uppercase* exponential
single character (accepts integer or single character string)
Format Presentation for % ------------------------- same as
``s``, but converts any object using
``repr()``Format Presentation for .format() --------------------------------- ``d`` or
``g`` with locale-specific characters
percentage, like
``f``, but multiplies the number by 100 and adds a percent
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 (
``+000120``, valid only for numbers)
sign-aware zero-padding for numeric types (like
``{:0=}``)
comma as thousands sparator (l10n: use
``n``)
<div style="max-width: 600px;">
the group matches the empty string; the letters set the corresponding flags
a non-capturing version of regular parentheses
the substring matched by the group is accessible via the symbolic group
backreference: matches whatever text was matched by the earlier named group
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
``(?(id/name)yes-pattern|no-pattern)`` sorcery.
``(<)?(\w+@\w+(?:\.\w+)+)(?(1)>)``