mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
#5348: format() converts all kinds of values.
This commit is contained in:
parent
8ad554fdbe
commit
528f8810aa
1 changed files with 20 additions and 0 deletions
|
@ -425,6 +425,26 @@ available. They are listed here in alphabetical order.
|
||||||
|
|
||||||
The float type is described in :ref:`typesnumeric`.
|
The float type is described in :ref:`typesnumeric`.
|
||||||
|
|
||||||
|
|
||||||
|
.. function:: format(value[, format_spec])
|
||||||
|
|
||||||
|
.. index::
|
||||||
|
pair: str; format
|
||||||
|
single: __format__
|
||||||
|
|
||||||
|
Convert a *value* to a "formatted" representation, as controlled by
|
||||||
|
*format_spec*. The interpretation of *format_spec* will depend on the type
|
||||||
|
of the *value* argument, however there is a standard formatting syntax that
|
||||||
|
is used by most built-in types: :ref:`formatspec`.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
|
||||||
|
``format(value, format_spec)`` merely calls
|
||||||
|
``value.__format__(format_spec)``.
|
||||||
|
|
||||||
|
.. versionadded:: 2.6
|
||||||
|
|
||||||
|
|
||||||
.. function:: frozenset([iterable])
|
.. function:: frozenset([iterable])
|
||||||
:noindex:
|
:noindex:
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue