chunk_id stringlengths 36 36 | source stringclasses 35
values | source_url stringlengths 0 290 | upstream_license stringclasses 1
value | document_id stringlengths 36 36 | chunk_index int64 0 324k | retrieved_at stringclasses 2
values | chunker_version stringclasses 4
values | content_hash stringlengths 15 64 | content stringlengths 50 44.7k | namespace stringclasses 9
values | source_name stringclasses 35
values | raw_text stringlengths 50 44.7k | cleaned_text stringlengths 50 44.7k | tags stringclasses 49
values | collection_name stringclasses 11
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
359586ad-9b1a-4955-85a4-7fd0771d90fa | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,936 | supabase-export-v2 | 356b91f2ad462f8b | ``'_'`` | Inserts an underscore every 3 digits for | | | integer presentation type ``'d'`` and | | | floating-point presentation types, excluding ``'n'``.
|
| | For integer presentation types |
| | ``'b'``, ``'o'``, ``'x'``, and ``'X'``, |
| | underscores are inserted every 4 digits. |
| | For other presentation types,... | trusted_official_docs | CPython Docs | ``'_'`` | Inserts an underscore every 3 digits for | | | integer presentation type ``'d'`` and | | | floating-point presentation types, excluding ``'n'``.
|
| | For integer presentation types |
| | ``'b'``, ``'o'``, ``'x'``, and ``'X'``, |
| | underscores are inserted every 4 digits. |
| | For other presentation types,... | ``'_'`` | Inserts an underscore every 3 digits for | | | integer presentation type ``'d'`` and | | | floating-point presentation types, excluding ``'n'``.
|
| | For integer presentation types |
| | ``'b'``, ``'o'``, ``'x'``, and ``'X'``, |
| | underscores are inserted every 4 digits. |
| | For other presentation types,... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
35e84e27-1791-4ed2-90f2-22ea2a84293c | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,923 | supabase-export-v2 | 983459bd1697889e | .. index:: single: + (plus); in string formatting single: - (minus); in string formatting single: space; in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``'+'`` | Indicates that a si... | trusted_official_docs | CPython Docs | .. index:: single: + (plus); in string formatting single: - (minus); in string formatting single: space; in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``'+'`` | Indicates that a si... | .. index:: single: + (plus); in string formatting single: - (minus); in string formatting single: space; in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``'+'`` | Indicates that a si... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
367b6c65-e578-4a7f-a335-2953b695f3b6 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,877 | supabase-export-v2 | a7bb83b18d6d59c1 | to be called with a *key* argument of 0. The ``name`` attribute will be looked up after :meth:`get_value` returns by calling the built-in :func:`getattr` function.
If the index or keyword refers to an item that does not exist, then an
:exc:`IndexError` or :exc:`KeyError` should be raised. | trusted_official_docs | CPython Docs | to be called with a *key* argument of 0. The ``name`` attribute will be looked up after :meth:`get_value` returns by calling the built-in :func:`getattr` function.
If the index or keyword refers to an item that does not exist, then an
:exc:`IndexError` or :exc:`KeyError` should be raised. | to be called with a *key* argument of 0. The ``name`` attribute will be looked up after :meth:`get_value` returns by calling the built-in :func:`getattr` function.
If the index or keyword refers to an item that does not exist, then an
:exc:`IndexError` or :exc:`KeyError` should be raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
368fe60d-b523-4a12-8c69-cf6d246fe61c | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,950 | supabase-export-v2 | ab8375d7a23577dc | | | precision of ``6`` digits after the decimal point for | | | :class:`float`, and shows all coefficient digits | | | for :class:`~decimal.Decimal`.
If ``p=0``, the decimal |
| | point is omitted unless the ``#`` option is used. |
| | |
| | For :class:`float`, the exponent always contains at |
| | least two digits... | trusted_official_docs | CPython Docs | | | precision of ``6`` digits after the decimal point for | | | :class:`float`, and shows all coefficient digits | | | for :class:`~decimal.Decimal`.
If ``p=0``, the decimal |
| | point is omitted unless the ``#`` option is used. |
| | |
| | For :class:`float`, the exponent always contains at |
| | least two digits... | | | precision of ``6`` digits after the decimal point for | | | :class:`float`, and shows all coefficient digits | | | for :class:`~decimal.Decimal`.
If ``p=0``, the decimal |
| | point is omitted unless the ``#`` option is used. |
| | |
| | For :class:`float`, the exponent always contains at |
| | least two digits... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3909826b-4c29-420b-baa0-6d7c604b900b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,006 | supabase-export-v2 | 972c5f835ce5ea16 | keyword arguments, where the keywords are the placeholders. When both *mapping* and *kwds* are given and there are duplicates, the placeholders from *kwds* take precedence.
.. method:: safe_substitute(mapping={}, /, **kwds) | trusted_official_docs | CPython Docs | keyword arguments, where the keywords are the placeholders. When both *mapping* and *kwds* are given and there are duplicates, the placeholders from *kwds* take precedence.
.. method:: safe_substitute(mapping={}, /, **kwds) | keyword arguments, where the keywords are the placeholders. When both *mapping* and *kwds* are given and there are duplicates, the placeholders from *kwds* take precedence.
.. method:: safe_substitute(mapping={}, /, **kwds) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3c56a9ff-f1d9-4f7c-bbc6-032d0a8275f7 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,883 | supabase-export-v2 | f5131fb72dc5d55c | .. 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 's' (str), 'r' (repr) and 'a' (ascii) conversion
types. | trusted_official_docs | CPython Docs | .. 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 's' (str), 'r' (repr) and 'a' (ascii) conversion
types. | .. 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 's' (str), 'r' (repr) and 'a' (ascii) conversion
types. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3dd11d30-d043-4d94-92eb-e4f83e9096b3 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,034 | supabase-export-v2 | c327aabfafa8239d | * *braced* -- This group matches the brace enclosed placeholder name; it should not include either the delimiter or braces in the capturing group.
* *invalid* -- This group matches any other delimiter pattern (usually a single
delimiter), and it should appear last in the regular expression. | trusted_official_docs | CPython Docs | * *braced* -- This group matches the brace enclosed placeholder name; it should not include either the delimiter or braces in the capturing group.
* *invalid* -- This group matches any other delimiter pattern (usually a single
delimiter), and it should appear last in the regular expression. | * *braced* -- This group matches the brace enclosed placeholder name; it should not include either the delimiter or braces in the capturing group.
* *invalid* -- This group matches any other delimiter pattern (usually a single
delimiter), and it should appear last in the regular expression. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3e8f9208-2834-41e3-89aa-e8c99a37d367 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,951 | supabase-export-v2 | c4602968ae68afc3 | a given precision ``p``, | | | formats the number as a decimal number with exactly | | | ``p`` digits following the decimal point.
With no |
| | precision given, uses a precision of ``6`` digits after |
| | the decimal point for :class:`float`, and uses a |
| | precision large enough to show all coefficient digits |... | trusted_official_docs | CPython Docs | a given precision ``p``, | | | formats the number as a decimal number with exactly | | | ``p`` digits following the decimal point.
With no |
| | precision given, uses a precision of ``6`` digits after |
| | the decimal point for :class:`float`, and uses a |
| | precision large enough to show all coefficient digits |... | a given precision ``p``, | | | formats the number as a decimal number with exactly | | | ``p`` digits following the decimal point.
With no |
| | precision given, uses a precision of ``6`` digits after |
| | the decimal point for :class:`float`, and uses a |
| | precision large enough to show all coefficient digits |... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
3f121b08-767e-4c69-a92d-278709bd614b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,001 | supabase-export-v2 | 6cad2ef70d9a2926 | Any other appearance of ``$`` in the string will result in a :exc:`ValueError` being raised.
The :mod:`!string` module provides a :class:`Template` class that implements
these rules. The methods of :class:`Template` are: | trusted_official_docs | CPython Docs | Any other appearance of ``$`` in the string will result in a :exc:`ValueError` being raised.
The :mod:`!string` module provides a :class:`Template` class that implements
these rules. The methods of :class:`Template` are: | Any other appearance of ``$`` in the string will result in a :exc:`ValueError` being raised.
The :mod:`!string` module provides a :class:`Template` class that implements
these rules. The methods of :class:`Template` are: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4146f07e-537c-45ca-99fa-bd0f35171d99 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,924 | supabase-export-v2 | ff043da88f4e0b6e | space | Indicates that a leading space should be used on | | | positive numbers, and a minus sign on negative numbers. | +---------+----------------------------------------------------------+
.. index:: single: z; in string formatting | trusted_official_docs | CPython Docs | space | Indicates that a leading space should be used on | | | positive numbers, and a minus sign on negative numbers. | +---------+----------------------------------------------------------+
.. index:: single: z; in string formatting | space | Indicates that a leading space should be used on | | | positive numbers, and a minus sign on negative numbers. | +---------+----------------------------------------------------------+
.. index:: single: z; in string formatting | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
42b676ed-5a16-459d-ab98-8909f086624e | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,869 | supabase-export-v2 | c20856f58bf626f6 | return an iterable of tuples (*literal_text*, *field_name*, *format_spec*, *conversion*). This is used by :meth:`vformat` to break the string into 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 lit... | trusted_official_docs | CPython Docs | return an iterable of tuples (*literal_text*, *field_name*, *format_spec*, *conversion*). This is used by :meth:`vformat` to break the string into 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 lit... | return an iterable of tuples (*literal_text*, *field_name*, *format_spec*, *conversion*). This is used by :meth:`vformat` to break the string into 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 lit... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
43e9fffd-71ab-422a-a4d1-df91c6e9488d | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,025 | supabase-export-v2 | 511953b30443b608 | Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with some non-ASCII characters. That's why we use the local ``a`` flag here.
.. versionchanged:: 3.7
*braceidpattern* can be used to define separate patterns used inside and
outside the braces. | trusted_official_docs | CPython Docs | Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with some non-ASCII characters. That's why we use the local ``a`` flag here.
.. versionchanged:: 3.7
*braceidpattern* can be used to define separate patterns used inside and
outside the braces. | Since default *flags* is ``re.IGNORECASE``, pattern ``[a-z]`` can match with some non-ASCII characters. That's why we use the local ``a`` flag here.
.. versionchanged:: 3.7
*braceidpattern* can be used to define separate patterns used inside and
outside the braces. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
46834bf4-c47c-4bd8-b239-1f7d44c35b55 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,038 | supabase-export-v2 | 221171e6e4c46667 | .. function:: capwords(s, sep=None)
Split the argument into words using :meth:`str.split`, capitalize each word
using :meth:`str.capitalize`, and join the capitalized words using
:meth:`str.join`. If the optional second argument *sep* is absent
or ``None``, runs of whitespace characters are replaced by a single spac... | trusted_official_docs | CPython Docs | .. function:: capwords(s, sep=None)
Split the argument into words using :meth:`str.split`, capitalize each word
using :meth:`str.capitalize`, and join the capitalized words using
:meth:`str.join`. If the optional second argument *sep* is absent
or ``None``, runs of whitespace characters are replaced by a single spac... | .. function:: capwords(s, sep=None)
Split the argument into words using :meth:`str.split`, capitalize each word
using :meth:`str.capitalize`, and join the capitalized words using
:meth:`str.join`. If the optional second argument *sep* is absent
or ``None``, runs of whitespace characters are replaced by a single spac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47349eb1-cb2b-43f1-ac6d-7d9ba3dff97b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,901 | supabase-export-v2 | f9be4c26a01b81f7 | as a string, overriding its own definition of formatting. By converting the value to a string before calling :meth:`~object.__format__`, the normal formatting logic is bypassed.
Three conversion flags are currently supported: ``'!s'`` which calls :func:`str`
on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` ... | trusted_official_docs | CPython Docs | as a string, overriding its own definition of formatting. By converting the value to a string before calling :meth:`~object.__format__`, the normal formatting logic is bypassed.
Three conversion flags are currently supported: ``'!s'`` which calls :func:`str`
on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` ... | as a string, overriding its own definition of formatting. By converting the value to a string before calling :meth:`~object.__format__`, the normal formatting logic is bypassed.
Three conversion flags are currently supported: ``'!s'`` which calls :func:`str`
on the value, ``'!r'`` which calls :func:`repr` and ``'!a'`` ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
474b32c8-6543-4cd8-95d7-d0c88c60ea88 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,858 | supabase-export-v2 | 62109648b75777bd | Custom string formatting ------------------------
The built-in string class provides the ability to do complex variable
substitutions and value formatting via the :meth:`~str.format` method described in
:pep:`3101`. The :class:`Formatter` class in the :mod:`!string` module allows
you to create and customize your own st... | trusted_official_docs | CPython Docs | Custom string formatting ------------------------
The built-in string class provides the ability to do complex variable
substitutions and value formatting via the :meth:`~str.format` method described in
:pep:`3101`. The :class:`Formatter` class in the :mod:`!string` module allows
you to create and customize your own st... | Custom string formatting ------------------------
The built-in string class provides the ability to do complex variable
substitutions and value formatting via the :meth:`~str.format` method described in
:pep:`3101`. The :class:`Formatter` class in the :mod:`!string` module allows
you to create and customize your own st... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
47736f0b-fd3d-4b24-8202-af0801229295 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,019 | supabase-export-v2 | 6993d386d9683e78 | Here is an example of how to use a Template::
>>> from string import Template
>>> s = Template('$who likes $what')
>>> s.substitute(who='tim', what='kung pao')
'tim likes kung pao'
>>> d = dict(who='tim')
>>> Template('Give $who $100').substitute(d)
Traceback (most recent call last):
... ValueError: Invalid plac... | trusted_official_docs | CPython Docs | Here is an example of how to use a Template::
>>> from string import Template
>>> s = Template('$who likes $what')
>>> s.substitute(who='tim', what='kung pao')
'tim likes kung pao'
>>> d = dict(who='tim')
>>> Template('Give $who $100').substitute(d)
Traceback (most recent call last):
... ValueError: Invalid plac... | Here is an example of how to use a Template::
>>> from string import Template
>>> s = Template('$who likes $what')
>>> s.substitute(who='tim', what='kung pao')
'tim likes kung pao'
>>> d = dict(who='tim')
>>> Template('Give $who $100').substitute(d)
Traceback (most recent call last):
... ValueError: Invalid plac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
4c5a18a6-846a-4f89-b8f7-ec771dbeb767 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,028 | supabase-export-v2 | 3b9b53873bd483d5 | .. versionadded:: 3.7
* *flags* -- The regular expression flags that will be applied when compiling
the regular expression used for recognizing substitutions. The default value
is ``re.IGNORECASE``. Note that ``re.VERBOSE`` will always be added to the
flags, so custom *idpattern*\ s must follow conventions for verbo... | trusted_official_docs | CPython Docs | .. versionadded:: 3.7
* *flags* -- The regular expression flags that will be applied when compiling
the regular expression used for recognizing substitutions. The default value
is ``re.IGNORECASE``. Note that ``re.VERBOSE`` will always be added to the
flags, so custom *idpattern*\ s must follow conventions for verbo... | .. versionadded:: 3.7
* *flags* -- The regular expression flags that will be applied when compiling
the regular expression used for recognizing substitutions. The default value
is ``re.IGNORECASE``. Note that ``re.VERBOSE`` will always be added to the
flags, so custom *idpattern*\ s must follow conventions for verbo... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5002cfc7-e507-41c7-8830-2b8450227376 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,993 | supabase-export-v2 | e4120e8ff6e2c068 | was introduced in Python 2.4; a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`, and :ref:`template string literals <template-strings>`.
It is unrelated to template string literals (t-strings),
which were introduced in Python 3.14. T... | trusted_official_docs | CPython Docs | was introduced in Python 2.4; a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`, and :ref:`template string literals <template-strings>`.
It is unrelated to template string literals (t-strings),
which were introduced in Python 3.14. T... | was introduced in Python 2.4; a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`, and :ref:`template string literals <template-strings>`.
It is unrelated to template string literals (t-strings),
which were introduced in Python 3.14. T... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
50c60aa9-b52d-47f3-96b6-17324dc03e47 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,873 | supabase-export-v2 | 56555942e60644bb | .. 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
named argument in *kwargs*. | trusted_official_docs | CPython Docs | .. 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
named argument in *kwargs*. | .. 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
named argument in *kwargs*. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
515adec9-46ef-43e9-be4b-0afe5e6f82f4 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,932 | supabase-export-v2 | ab8091440b84b93b | .. versionchanged:: 3.10 Preceding the *width* field by ``'0'`` no longer affects the default alignment for strings.
The *precision* is a decimal integer indicating how many digits should be
displayed after the decimal point for presentation types
``'f'`` and ``'F'``, or before and after the decimal point for presentat... | trusted_official_docs | CPython Docs | .. versionchanged:: 3.10 Preceding the *width* field by ``'0'`` no longer affects the default alignment for strings.
The *precision* is a decimal integer indicating how many digits should be
displayed after the decimal point for presentation types
``'f'`` and ``'F'``, or before and after the decimal point for presentat... | .. versionchanged:: 3.10 Preceding the *width* field by ``'0'`` no longer affects the default alignment for strings.
The *precision* is a decimal integer indicating how many digits should be
displayed after the decimal point for presentation types
``'f'`` and ``'F'``, or before and after the decimal point for presentat... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
515f1020-0cc4-475c-800e-f1071180eab4 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,918 | supabase-export-v2 | 33dd590bb3c3d8aa | index:: single: < (less); in string formatting single: > (greater); in string formatting single: = (equals); in string formatting single: ^ (caret); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+===============================================... | trusted_official_docs | CPython Docs | index:: single: < (less); in string formatting single: > (greater); in string formatting single: = (equals); in string formatting single: ^ (caret); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+===============================================... | index:: single: < (less); in string formatting single: > (greater); in string formatting single: = (equals); in string formatting single: ^ (caret); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+===============================================... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
51e85c43-f683-4477-b6f4-77abd1594841 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,863 | supabase-export-v2 | ce31e382c04aa741 | primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. It is just a wrapper that calls :meth:`vformat`.
.. versionchanged:: 3.7
A format string argument is now :ref:`positional-only
<positional-only_parameter>`. | trusted_official_docs | CPython Docs | primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. It is just a wrapper that calls :meth:`vformat`.
.. versionchanged:: 3.7
A format string argument is now :ref:`positional-only
<positional-only_parameter>`. | primary API method. It takes a format string and an arbitrary set of positional and keyword arguments. It is just a wrapper that calls :meth:`vformat`.
.. versionchanged:: 3.7
A format string argument is now :ref:`positional-only
<positional-only_parameter>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
5cc815f0-cd55-4e0e-9b10-75cf3ec2089b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,952 | supabase-export-v2 | c162aba7efd9ea8e | | Fixed-point notation. Same as ``'f'``, but converts | | | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | +---------+----------------------------------------------------------+ | ``'g'`` | General format.
For a given precision ``p >= 1``, |
| | this rounds the number to ``p`` significant digits and |
| | then formats ... | trusted_official_docs | CPython Docs | | Fixed-point notation. Same as ``'f'``, but converts | | | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | +---------+----------------------------------------------------------+ | ``'g'`` | General format.
For a given precision ``p >= 1``, |
| | this rounds the number to ``p`` significant digits and |
| | then formats ... | | Fixed-point notation. Same as ``'f'``, but converts | | | ``nan`` to ``NAN`` and ``inf`` to ``INF``. | +---------+----------------------------------------------------------+ | ``'g'`` | General format.
For a given precision ``p >= 1``, |
| | this rounds the number to ``p`` significant digits and |
| | then formats ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
61c6898f-775b-44ff-a7e9-ed0281d651d9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,930 | supabase-export-v2 | 739709b6badd4557 | minimum total field width, including any prefixes, separators, and other formatting characters. If not specified, then the field width will be determined by the content.
When no explicit alignment is given, preceding the *width* field by a zero
(``'0'``) character enables sign-aware zero-padding for numeric types,
excl... | trusted_official_docs | CPython Docs | minimum total field width, including any prefixes, separators, and other formatting characters. If not specified, then the field width will be determined by the content.
When no explicit alignment is given, preceding the *width* field by a zero
(``'0'``) character enables sign-aware zero-padding for numeric types,
excl... | minimum total field width, including any prefixes, separators, and other formatting characters. If not specified, then the field width will be determined by the content.
When no explicit alignment is given, preceding the *width* field by a zero
(``'0'``) character enables sign-aware zero-padding for numeric types,
excl... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
621389b4-9f80-413b-8a26-53205d11adf8 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,005 | supabase-export-v2 | 7382bfd36d965196 | .. method:: substitute(mapping={}, /, **kwds)
Performs the template substitution, returning a new string. *mapping* is
any dictionary-like object with keys that match the placeholders in the
template. Alternatively, you can provide keyword arguments, where the
keywords are the placeholders. When both *mapping* and *... | trusted_official_docs | CPython Docs | .. method:: substitute(mapping={}, /, **kwds)
Performs the template substitution, returning a new string. *mapping* is
any dictionary-like object with keys that match the placeholders in the
template. Alternatively, you can provide keyword arguments, where the
keywords are the placeholders. When both *mapping* and *... | .. method:: substitute(mapping={}, /, **kwds)
Performs the template substitution, returning a new string. *mapping* is
any dictionary-like object with keys that match the placeholders in the
template. Alternatively, you can provide keyword arguments, where the
keywords are the placeholders. When both *mapping* and *... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6408de26-e0ab-4b92-be83-ed67caebbec3 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,934 | supabase-export-v2 | 9f67d39b26a49482 | and *precision* fields specifies a digit group separator for the integral and fractional parts of a number respectively. It can be one of the following:
.. index::
single: , (comma); in string formatting
single: _ (underscore); in string formatting | trusted_official_docs | CPython Docs | and *precision* fields specifies a digit group separator for the integral and fractional parts of a number respectively. It can be one of the following:
.. index::
single: , (comma); in string formatting
single: _ (underscore); in string formatting | and *precision* fields specifies a digit group separator for the integral and fractional parts of a number respectively. It can be one of the following:
.. index::
single: , (comma); in string formatting
single: _ (underscore); in string formatting | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6427c050-dd19-44b9-84ee-8e5d40d6f6d3 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,891 | supabase-export-v2 | b2c25d73e3008b5e | arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+] attribute_name: `~python-grammar:identifier` element_index: `~python-grammar:digit`+ | `index_string` index_string: <any source character except "]"> + conversion: "r" | "s" | "a" format_spec: `format-spec:format_spec`
In less formal terms, the replace... | trusted_official_docs | CPython Docs | arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+] attribute_name: `~python-grammar:identifier` element_index: `~python-grammar:digit`+ | `index_string` index_string: <any source character except "]"> + conversion: "r" | "s" | "a" format_spec: `format-spec:format_spec`
In less formal terms, the replace... | arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+] attribute_name: `~python-grammar:identifier` element_index: `~python-grammar:digit`+ | `index_string` index_string: <any source character except "]"> + conversion: "r" | "s" | "a" format_spec: `format-spec:format_spec`
In less formal terms, the replace... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6573444f-1a00-4a26-8b5d-f11e62053fc8 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,030 | supabase-export-v2 | a957d720189b840e | .. versionadded:: 3.2
Alternatively, you can provide the entire regular expression pattern by
overriding the class attribute *pattern*. If you do this, the value must be a
regular expression object with four named capturing groups. The capturing
groups correspond to the rules given above, along with the invalid placeho... | trusted_official_docs | CPython Docs | .. versionadded:: 3.2
Alternatively, you can provide the entire regular expression pattern by
overriding the class attribute *pattern*. If you do this, the value must be a
regular expression object with four named capturing groups. The capturing
groups correspond to the rules given above, along with the invalid placeho... | .. versionadded:: 3.2
Alternatively, you can provide the entire regular expression pattern by
overriding the class attribute *pattern*. If you do this, the value must be a
regular expression object with four named capturing groups. The capturing
groups correspond to the rules given above, along with the invalid placeho... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
666f521f-d037-47f1-be2f-d728126c7279 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,886 | supabase-export-v2 | ac484e5e98659dfb | Format string syntax --------------------
The :meth:`str.format` method and the :class:`Formatter` class share the same
syntax for format strings (although in the case of :class:`Formatter`,
subclasses can define their own format string syntax). The syntax is
related to that of :ref:`formatted string literals <f-string... | trusted_official_docs | CPython Docs | Format string syntax --------------------
The :meth:`str.format` method and the :class:`Formatter` class share the same
syntax for format strings (although in the case of :class:`Formatter`,
subclasses can define their own format string syntax). The syntax is
related to that of :ref:`formatted string literals <f-string... | Format string syntax --------------------
The :meth:`str.format` method and the :class:`Formatter` class share the same
syntax for format strings (although in the case of :class:`Formatter`,
subclasses can define their own format string syntax). The syntax is
related to that of :ref:`formatted string literals <f-string... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
680e1f43-2065-4117-911c-5be24020ff1b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,890 | supabase-export-v2 | c0a4ff9773433f21 | The grammar for a replacement field is as follows:
.. productionlist:: format-string
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
attribute... | trusted_official_docs | CPython Docs | The grammar for a replacement field is as follows:
.. productionlist:: format-string
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
attribute... | The grammar for a replacement field is as follows:
.. productionlist:: format-string
replacement_field: "{" [`field_name`] ["!" `conversion`] [":" `format_spec`] "}"
field_name: `arg_name` ("." `attribute_name` | "[" `element_index` "]")*
arg_name: [`~python-grammar:identifier` | `~python-grammar:digit`+]
attribute... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
69e826e4-2f91-4f5d-9c05-4599d3635909 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,888 | supabase-export-v2 | 450f883d8d6d9d74 | single: . (dot); in string formatting single: [] (square brackets); in string formatting single: ! (exclamation); in string formatting single: : (colon); in string formatting
Format strings contain "replacement fields" surrounded by curly braces ``{}``. Anything that is not contained in braces is considered literal tex... | trusted_official_docs | CPython Docs | single: . (dot); in string formatting single: [] (square brackets); in string formatting single: ! (exclamation); in string formatting single: : (colon); in string formatting
Format strings contain "replacement fields" surrounded by curly braces ``{}``. Anything that is not contained in braces is considered literal tex... | single: . (dot); in string formatting single: [] (square brackets); in string formatting single: ! (exclamation); in string formatting single: : (colon); in string formatting
Format strings contain "replacement fields" surrounded by curly braces ``{}``. Anything that is not contained in braces is considered literal tex... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6aa2a034-6ef7-42f1-9655-ee655f6a0370 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,922 | supabase-export-v2 | cdf507ce72b2874c | The *sign* option is only valid for number types, and can be one of the following:
.. index::
single: + (plus); in string formatting
single: - (minus); in string formatting
single: space; in string formatting | trusted_official_docs | CPython Docs | The *sign* option is only valid for number types, and can be one of the following:
.. index::
single: + (plus); in string formatting
single: - (minus); in string formatting
single: space; in string formatting | The *sign* option is only valid for number types, and can be one of the following:
.. index::
single: + (plus); in string formatting
single: - (minus); in string formatting
single: space; in string formatting | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6b4f4f4a-e7b9-48ca-8158-f7c9eb3e28b4 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,979 | supabase-export-v2 | 1d9012c6c15deff0 | show a space for positive numbers ' 3.140000; -3.140000' >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:f}; {:f}' '3.140000; -3.140000'
Replacing ``%x`` and ``%o`` and converting the value to different bases:: | trusted_official_docs | CPython Docs | show a space for positive numbers ' 3.140000; -3.140000' >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:f}; {:f}' '3.140000; -3.140000'
Replacing ``%x`` and ``%o`` and converting the value to different bases:: | show a space for positive numbers ' 3.140000; -3.140000' >>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:f}; {:f}' '3.140000; -3.140000'
Replacing ``%x`` and ``%o`` and converting the value to different bases:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
6c50212d-a948-4e9d-bead-d4d4a03245a2 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,935 | supabase-export-v2 | 685858299a5ef335 | .. index:: single: , (comma); in string formatting single: _ (underscore); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``','`` | Inserts a comma every 3 digits for |
| | integer ... | trusted_official_docs | CPython Docs | .. index:: single: , (comma); in string formatting single: _ (underscore); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``','`` | Inserts a comma every 3 digits for |
| | integer ... | .. index:: single: , (comma); in string formatting single: _ (underscore); in string formatting
+---------+----------------------------------------------------------+
| Option | Meaning |
+=========+==========================================================+
| ``','`` | Inserts a comma every 3 digits for |
| | integer ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
723f7211-6836-49e5-91de-c59c7447fe80 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,958 | supabase-export-v2 | 5310069ee7099a56 | | | | The overall effect is to match the output of :func:`str` | | | as altered by the other format modifiers. | +---------+----------------------------------------------------------+
The result should be correctly rounded to a given precision ``p`` of digits
after the decimal point. The rounding mode for :class:`float... | trusted_official_docs | CPython Docs | | | | The overall effect is to match the output of :func:`str` | | | as altered by the other format modifiers. | +---------+----------------------------------------------------------+
The result should be correctly rounded to a given precision ``p`` of digits
after the decimal point. The rounding mode for :class:`float... | | | | The overall effect is to match the output of :func:`str` | | | as altered by the other format modifiers. | +---------+----------------------------------------------------------+
The result should be correctly rounded to a given precision ``p`` of digits
after the decimal point. The rounding mode for :class:`float... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
759db174-7247-4327-a18e-279fdfb2eb31 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,945 | supabase-export-v2 | acc3bec53aaa3e23 | The available integer presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'b'`` | Binary format. Outputs the number in base 2. |
+---------+---------------------------------------... | trusted_official_docs | CPython Docs | The available integer presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'b'`` | Binary format. Outputs the number in base 2. |
+---------+---------------------------------------... | The available integer presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'b'`` | Binary format. Outputs the number in base 2. |
+---------+---------------------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
76b2066f-a764-400a-aceb-c690b8fda0d9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,913 | supabase-export-v2 | 08cbf8455b671daf | an empty format specification produces the same result as if you had called :func:`str` on the value. A non-empty format specification typically modifies the result.
The general form of a *standard format specifier* is: | trusted_official_docs | CPython Docs | an empty format specification produces the same result as if you had called :func:`str` on the value. A non-empty format specification typically modifies the result.
The general form of a *standard format specifier* is: | an empty format specification produces the same result as if you had called :func:`str` on the value. A non-empty format specification typically modifies the result.
The general form of a *standard format specifier* is: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7770f520-1525-4240-bf2f-b611e7ef7cb0 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,020 | supabase-export-v2 | 2a014a70a64611d8 | in string: line 1, col 11 >>> Template('$who likes $what').substitute(d) Traceback (most recent call last): ... KeyError: 'what' >>> Template('$who likes $what').safe_substitute(d) 'tim likes $what'
Advanced usage: you can derive subclasses of :class:`Template` to customize
the placeholder syntax, delimiter character, ... | trusted_official_docs | CPython Docs | in string: line 1, col 11 >>> Template('$who likes $what').substitute(d) Traceback (most recent call last): ... KeyError: 'what' >>> Template('$who likes $what').safe_substitute(d) 'tim likes $what'
Advanced usage: you can derive subclasses of :class:`Template` to customize
the placeholder syntax, delimiter character, ... | in string: line 1, col 11 >>> Template('$who likes $what').substitute(d) Traceback (most recent call last): ... KeyError: 'what' >>> Template('$who likes $what').safe_substitute(d) 'tim likes $what'
Advanced usage: you can derive subclasses of :class:`Template` to customize
the placeholder syntax, delimiter character, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7909a02c-259b-4424-bd7b-e04604ba177f | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,914 | supabase-export-v2 | f664c2f834730843 | The general form of a *standard format specifier* is:
.. productionlist:: format-spec
format_spec: [`options`][`width_and_precision`][`type`]
options: [[`fill`]`align`][`sign`]["z"]["#"]["0"]
fill: <any character>
align: "<" | ">" | "=" | "^"
sign: "+" | "-" | " "
width_and_precision: [`width_with_grouping`][`pre... | trusted_official_docs | CPython Docs | The general form of a *standard format specifier* is:
.. productionlist:: format-spec
format_spec: [`options`][`width_and_precision`][`type`]
options: [[`fill`]`align`][`sign`]["z"]["#"]["0"]
fill: <any character>
align: "<" | ">" | "=" | "^"
sign: "+" | "-" | " "
width_and_precision: [`width_with_grouping`][`pre... | The general form of a *standard format specifier* is:
.. productionlist:: format-spec
format_spec: [`options`][`width_and_precision`][`type`]
options: [[`fill`]`align`][`sign`]["z"]["#"]["0"]
fill: <any character>
align: "<" | ">" | "=" | "^"
sign: "+" | "-" | " "
width_and_precision: [`width_with_grouping`][`pre... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7b4169db-c057-498a-8502-5efd01ba8b31 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,988 | supabase-export-v2 | 42e20d6e0747248e | Nesting arguments and more complex examples::
>>> for align, text in zip('<^>', ['left', 'center', 'right']):
... '{0:{fill}{align}16}'.format(text, fill=align, align=align)
... 'left<<<<<<<<<<<<'
'^^^^^center^^^^^'
'>>>>>>>>>>>right'
>>>
>>> octets = [192, 168, 0, 1]
>>> '{:02X}{:02X}{:02X}{:02X}'.format(*octet... | trusted_official_docs | CPython Docs | Nesting arguments and more complex examples::
>>> for align, text in zip('<^>', ['left', 'center', 'right']):
... '{0:{fill}{align}16}'.format(text, fill=align, align=align)
... 'left<<<<<<<<<<<<'
'^^^^^center^^^^^'
'>>>>>>>>>>>right'
>>>
>>> octets = [192, 168, 0, 1]
>>> '{:02X}{:02X}{:02X}{:02X}'.format(*octet... | Nesting arguments and more complex examples::
>>> for align, text in zip('<^>', ['left', 'center', 'right']):
... '{0:{fill}{align}16}'.format(text, fill=align, align=align)
... 'left<<<<<<<<<<<<'
'^^^^^center^^^^^'
'>>>>>>>>>>>right'
>>>
>>> octets = [192, 168, 0, 1]
>>> '{:02X}{:02X}{:02X}{:02X}'.format(*octet... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7de414b0-7096-4b5c-a7c5-262442280a70 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,031 | supabase-export-v2 | bdaa0db7403c3d55 | be a regular expression object with four named capturing groups. The capturing groups correspond to the rules given above, along with the invalid placeholder rule:
* *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the
default pattern. | trusted_official_docs | CPython Docs | be a regular expression object with four named capturing groups. The capturing groups correspond to the rules given above, along with the invalid placeholder rule:
* *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the
default pattern. | be a regular expression object with four named capturing groups. The capturing groups correspond to the rules given above, along with the invalid placeholder rule:
* *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the
default pattern. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
7e21ed24-8e9a-48f6-8e0b-22c6aed8488c | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,999 | supabase-export-v2 | 8851762b8a4861f7 | ASCII alphanumeric string (including underscores) that starts with an underscore or ASCII letter. The first non-identifier character after the ``$`` character terminates this placeholder specification.
* ``${identifier}`` is equivalent to ``$identifier``. It is required when
valid identifier characters follow the plac... | trusted_official_docs | CPython Docs | ASCII alphanumeric string (including underscores) that starts with an underscore or ASCII letter. The first non-identifier character after the ``$`` character terminates this placeholder specification.
* ``${identifier}`` is equivalent to ``$identifier``. It is required when
valid identifier characters follow the plac... | ASCII alphanumeric string (including underscores) that starts with an underscore or ASCII letter. The first non-identifier character after the ``$`` character terminates this placeholder specification.
* ``${identifier}`` is equivalent to ``$identifier``. It is required when
valid identifier characters follow the plac... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
874b90d7-c5f8-4f5a-ab20-734af90c1fac | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,000 | supabase-export-v2 | 9983fcf8a5b63c99 | ``${identifier}`` is equivalent to ``$identifier``. It is required when valid identifier characters follow the placeholder but are not part of the placeholder, such as ``"${noun}ification"``.
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`
being raised. | trusted_official_docs | CPython Docs | ``${identifier}`` is equivalent to ``$identifier``. It is required when valid identifier characters follow the placeholder but are not part of the placeholder, such as ``"${noun}ification"``.
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`
being raised. | ``${identifier}`` is equivalent to ``$identifier``. It is required when valid identifier characters follow the placeholder but are not part of the placeholder, such as ``"${noun}ification"``.
Any other appearance of ``$`` in the string will result in a :exc:`ValueError`
being raised. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
89f7fe3b-dec4-47fb-be24-ade9cbde7d95 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,900 | supabase-export-v2 | 8926135937937d68 | .. _formatstrings-conversion:
The *conversion* field causes a type coercion before formatting. Normally, the
job of formatting a value is done by the :meth:`~object.__format__` method of the value
itself. However, in some cases it is desirable to force a type to be formatted
as a string, overriding its own definition o... | trusted_official_docs | CPython Docs | .. _formatstrings-conversion:
The *conversion* field causes a type coercion before formatting. Normally, the
job of formatting a value is done by the :meth:`~object.__format__` method of the value
itself. However, in some cases it is desirable to force a type to be formatted
as a string, overriding its own definition o... | .. _formatstrings-conversion:
The *conversion* field causes a type coercion before formatting. Normally, the
job of formatting a value is done by the :meth:`~object.__format__` method of the value
itself. However, in some cases it is desirable to force a type to be formatted
as a string, overriding its own definition o... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
8ab4bc90-b731-420f-b899-0297c22fb759 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,875 | supabase-export-v2 | a17902c38506c471 | The *args* parameter is set to the list of positional arguments to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of keyword arguments.
For compound field names, these functions are only called for the first
component of the field name; subsequent components are handled through
normal attribute ... | trusted_official_docs | CPython Docs | The *args* parameter is set to the list of positional arguments to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of keyword arguments.
For compound field names, these functions are only called for the first
component of the field name; subsequent components are handled through
normal attribute ... | The *args* parameter is set to the list of positional arguments to :meth:`vformat`, and the *kwargs* parameter is set to the dictionary of keyword arguments.
For compound field names, these functions are only called for the first
component of the field name; subsequent components are handled through
normal attribute ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
91c3ee88-e0e3-440f-90a0-3b05d3f09447 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,994 | supabase-export-v2 | af3c761545e8dc50 | It is unrelated to template string literals (t-strings), which were introduced in Python 3.14. These evaluate to :class:`string.templatelib.Template` objects, found in the :mod:`string.templatelib` module.
Template strings provide simpler string substitutions as described in
:pep:`292`. A primary use case for template ... | trusted_official_docs | CPython Docs | It is unrelated to template string literals (t-strings), which were introduced in Python 3.14. These evaluate to :class:`string.templatelib.Template` objects, found in the :mod:`string.templatelib` module.
Template strings provide simpler string substitutions as described in
:pep:`292`. A primary use case for template ... | It is unrelated to template string literals (t-strings), which were introduced in Python 3.14. These evaluate to :class:`string.templatelib.Template` objects, found in the :mod:`string.templatelib` module.
Template strings provide simpler string substitutions as described in
:pep:`292`. A primary use case for template ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
950dc733-e44e-4eca-8635-d824aa17223f | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,887 | supabase-export-v2 | 62829b4fc8c7665b | of :ref:`formatted string literals <f-strings>` and :ref:`template string literals <t-strings>`, but it is less sophisticated and, in particular, does not support arbitrary expressions in interpolations.
.. index::
single: {} (curly brackets); in string formatting
single: . (dot); in string formatting
single: [] (sq... | trusted_official_docs | CPython Docs | of :ref:`formatted string literals <f-strings>` and :ref:`template string literals <t-strings>`, but it is less sophisticated and, in particular, does not support arbitrary expressions in interpolations.
.. index::
single: {} (curly brackets); in string formatting
single: . (dot); in string formatting
single: [] (sq... | of :ref:`formatted string literals <f-strings>` and :ref:`template string literals <t-strings>`, but it is less sophisticated and, in particular, does not support arbitrary expressions in interpolations.
.. index::
single: {} (curly brackets); in string formatting
single: . (dot); in string formatting
single: [] (sq... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9770384b-845b-4d3c-a702-0bfbe65d3b0c | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,943 | supabase-export-v2 | 399013a6f4f2213c | The available string presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'s'`` | String format. This is the default type for strings and |
| | may be omitted. |
+---------+------... | trusted_official_docs | CPython Docs | The available string presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'s'`` | String format. This is the default type for strings and |
| | may be omitted. |
+---------+------... | The available string presentation types are:
+---------+----------------------------------------------------------+
| Type | Meaning |
+=========+==========================================================+
| ``'s'`` | String format. This is the default type for strings and |
| | may be omitted. |
+---------+------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9f96b298-8363-4dc6-8981-21db6bfd03a9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,959 | supabase-export-v2 | 3d279336efe01dbf | point. The rounding mode for :class:`float` matches that of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding mode of the current :ref:`context <decimal-context>` will be used.
The available presentation types for :class:`complex` are the same as those for
:class:`float` (``'%'`` is not allowed). B... | trusted_official_docs | CPython Docs | point. The rounding mode for :class:`float` matches that of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding mode of the current :ref:`context <decimal-context>` will be used.
The available presentation types for :class:`complex` are the same as those for
:class:`float` (``'%'`` is not allowed). B... | point. The rounding mode for :class:`float` matches that of the :func:`round` builtin. For :class:`~decimal.Decimal`, the rounding mode of the current :ref:`context <decimal-context>` will be used.
The available presentation types for :class:`complex` are the same as those for
:class:`float` (``'%'`` is not allowed). B... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
9fdcf05f-e2b7-4169-8abb-8683b9c12478 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,018 | supabase-export-v2 | b4da25af7a02cbd5 | This is the object passed to the constructor's *template* argument. In general, you shouldn't change it, but read-only access is not enforced.
Here is an example of how to use a Template:: | trusted_official_docs | CPython Docs | This is the object passed to the constructor's *template* argument. In general, you shouldn't change it, but read-only access is not enforced.
Here is an example of how to use a Template:: | This is the object passed to the constructor's *template* argument. In general, you shouldn't change it, but read-only access is not enforced.
Here is an example of how to use a Template:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a13f4d38-74f6-4e71-a38a-caa36735c120 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,874 | supabase-export-v2 | df75d01dfdf92f7a | an integer, it represents the index of the positional argument in *args*; if it is a string, then it represents a named argument in *kwargs*.
The *args* parameter is set to the list of positional arguments to
:meth:`vformat`, and the *kwargs* parameter is set to the dictionary of
keyword arguments. | trusted_official_docs | CPython Docs | an integer, it represents the index of the positional argument in *args*; if it is a string, then it represents a named argument in *kwargs*.
The *args* parameter is set to the list of positional arguments to
:meth:`vformat`, and the *kwargs* parameter is set to the dictionary of
keyword arguments. | an integer, it represents the index of the positional argument in *args*; if it is a string, then it represents a named argument in *kwargs*.
The *args* parameter is set to the list of positional arguments to
:meth:`vformat`, and the *kwargs* parameter is set to the dictionary of
keyword arguments. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a6a8ac4d-01c1-463c-aa26-eb2fe4b85dfb | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,898 | supabase-export-v2 | 2a677f11a2dfca3f | Some simple format string examples::
"First, thou shalt count to {0}" # References first positional argument
"Bring me a {}" # Implicitly references the first positional argument
"From {} to {}" # Same as "From {0} to {1}"
"My quest is {name}" # References keyword argument 'name'
"Weight in tons {0.weight}" # 'weig... | trusted_official_docs | CPython Docs | Some simple format string examples::
"First, thou shalt count to {0}" # References first positional argument
"Bring me a {}" # Implicitly references the first positional argument
"From {} to {}" # Same as "From {0} to {1}"
"My quest is {name}" # References keyword argument 'name'
"Weight in tons {0.weight}" # 'weig... | Some simple format string examples::
"First, thou shalt count to {0}" # References first positional argument
"Bring me a {}" # Implicitly references the first positional argument
"From {} to {}" # Same as "From {0} to {1}"
"My quest is {name}" # References keyword argument 'name'
"Weight in tons {0.weight}" # 'weig... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
a882b0aa-3b23-477d-b122-28ce6ca7faeb | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,992 | supabase-export-v2 | 1940e777c41c9d38 | .. note::
The feature described here was introduced in Python 2.4;
a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`,
and :ref:`template string literals <template-strings>`. | trusted_official_docs | CPython Docs | .. note::
The feature described here was introduced in Python 2.4;
a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`,
and :ref:`template string literals <template-strings>`. | .. note::
The feature described here was introduced in Python 2.4;
a simple templating method based upon regular expressions. It predates :meth:`str.format`, :ref:`formatted string literals <f-strings>`,
and :ref:`template string literals <template-strings>`. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
aaf5978b-72bd-46d8-9805-0796027c9b83 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,892 | supabase-export-v2 | 5ed6b3001f73b26e | preceded by an exclamation point ``'!'``, and a *format_spec*, which is preceded by a colon ``':'``. These specify a non-default format for the replacement value.
See also the :ref:`formatspec` section. | trusted_official_docs | CPython Docs | preceded by an exclamation point ``'!'``, and a *format_spec*, which is preceded by a colon ``':'``. These specify a non-default format for the replacement value.
See also the :ref:`formatspec` section. | preceded by an exclamation point ``'!'``, and a *format_spec*, which is preceded by a colon ``':'``. These specify a non-default format for the replacement value.
See also the :ref:`formatspec` section. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b5bd3339-bf75-48af-a11c-72fb1b893cae | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,955 | supabase-export-v2 | 9ead0dade954573f | as ``inf``, ``-inf``, | | | ``0``, ``-0`` and ``nan`` respectively, regardless of | | | the precision. | +---------+----------------------------------------------------------+ | ``'G'`` | General format.
Same as ``'g'`` except switches to |
| | ``'E'`` if the number gets too large. The |
| | representations of infini... | trusted_official_docs | CPython Docs | as ``inf``, ``-inf``, | | | ``0``, ``-0`` and ``nan`` respectively, regardless of | | | the precision. | +---------+----------------------------------------------------------+ | ``'G'`` | General format.
Same as ``'g'`` except switches to |
| | ``'E'`` if the number gets too large. The |
| | representations of infini... | as ``inf``, ``-inf``, | | | ``0``, ``-0`` and ``nan`` respectively, regardless of | | | the precision. | +---------+----------------------------------------------------------+ | ``'G'`` | General format.
Same as ``'g'`` except switches to |
| | ``'E'`` if the number gets too large. The |
| | representations of infini... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b6437a36-ea06-424b-a794-8c150d424190 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,032 | supabase-export-v2 | 7af47d7af5eb2345 | * *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the default pattern.
* *named* -- This group matches the unbraced placeholder name; it should not
include the delimiter in capturing group. | trusted_official_docs | CPython Docs | * *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the default pattern.
* *named* -- This group matches the unbraced placeholder name; it should not
include the delimiter in capturing group. | * *escaped* -- This group matches the escape sequence, e.g. ``$$``, in the default pattern.
* *named* -- This group matches the unbraced placeholder name; it should not
include the delimiter in capturing group. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b725e044-75c8-4738-b483-b7cd2545db83 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,907 | supabase-export-v2 | 38eb4d45415665c7 | The replacement fields within the format_spec are substituted before the *format_spec* string is interpreted. This allows the formatting of a value to be dynamically specified.
See the :ref:`formatexamples` section for some examples. | trusted_official_docs | CPython Docs | The replacement fields within the format_spec are substituted before the *format_spec* string is interpreted. This allows the formatting of a value to be dynamically specified.
See the :ref:`formatexamples` section for some examples. | The replacement fields within the format_spec are substituted before the *format_spec* string is interpreted. This allows the formatting of a value to be dynamically specified.
See the :ref:`formatexamples` section for some examples. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b7b08099-97d9-4d7e-b6c5-b72d268784dc | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,911 | supabase-export-v2 | 9628ea53153ecb7d | :ref:`t-strings`). They can also be passed directly to the built-in :func:`format` function. Each formattable type may define how the format specification is to be interpreted.
Most built-in types implement the following options for format specifications,
although some of the formatting options are only supported by th... | trusted_official_docs | CPython Docs | :ref:`t-strings`). They can also be passed directly to the built-in :func:`format` function. Each formattable type may define how the format specification is to be interpreted.
Most built-in types implement the following options for format specifications,
although some of the formatting options are only supported by th... | :ref:`t-strings`). They can also be passed directly to the built-in :func:`format` function. Each formattable type may define how the format specification is to be interpreted.
Most built-in types implement the following options for format specifications,
although some of the formatting options are only supported by th... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
b953a5ca-3d34-4830-8741-233e13cf8332 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,978 | supabase-export-v2 | 128efa10134ba924 | Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::
>>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always
'+3.140000; -3.140000'
>>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers
' 3.140000; -3.140000'
>>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:... | trusted_official_docs | CPython Docs | Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::
>>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always
'+3.140000; -3.140000'
>>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers
' 3.140000; -3.140000'
>>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:... | Replacing ``%+f``, ``%-f``, and ``% f`` and specifying a sign::
>>> '{:+f}; {:+f}'.format(3.14, -3.14) # show it always
'+3.140000; -3.140000'
>>> '{: f}; {: f}'.format(3.14, -3.14) # show a space for positive numbers
' 3.140000; -3.140000'
>>> '{:-f}; {:-f}'.format(3.14, -3.14) # show only the minus -- same as '{:... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bbcba3cf-eedb-4da6-a4be-0936c0df9235 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,035 | supabase-export-v2 | 1b2734e3b997acfc | * *invalid* -- This group matches any other delimiter pattern (usually a single delimiter), and it should appear last in the regular expression.
The methods on this class will raise :exc:`ValueError` if the pattern matches
the template without one of these named groups matching. | trusted_official_docs | CPython Docs | * *invalid* -- This group matches any other delimiter pattern (usually a single delimiter), and it should appear last in the regular expression.
The methods on this class will raise :exc:`ValueError` if the pattern matches
the template without one of these named groups matching. | * *invalid* -- This group matches any other delimiter pattern (usually a single delimiter), and it should appear last in the regular expression.
The methods on this class will raise :exc:`ValueError` if the pattern matches
the template without one of these named groups matching. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bcae4204-4eb1-4d4c-b2ec-f15ec96caac7 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,904 | supabase-export-v2 | f1464f03d982711f | on the argument first "Bring out the holy {name!r}" # Calls repr() on the argument first "More {!a}" # Calls ascii() on the argument first
The *format_spec* field contains a specification of how the value should be
presented, including such details as field width, alignment, padding, decimal
precision and so on. Each v... | trusted_official_docs | CPython Docs | on the argument first "Bring out the holy {name!r}" # Calls repr() on the argument first "More {!a}" # Calls ascii() on the argument first
The *format_spec* field contains a specification of how the value should be
presented, including such details as field width, alignment, padding, decimal
precision and so on. Each v... | on the argument first "Bring out the holy {name!r}" # Calls repr() on the argument first "More {!a}" # Calls ascii() on the argument first
The *format_spec* field contains a specification of how the value should be
presented, including such details as field width, alignment, padding, decimal
precision and so on. Each v... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
bcedb663-2cdf-4661-b7cb-4ed173e6eba9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,933 | supabase-export-v2 | 814ebcbc51d4c3e6 | field size - in other words, how many characters will be used from the field content. The *precision* is not allowed for integer presentation types.
The *grouping* option after *width* and *precision* fields specifies
a digit group separator for the integral and fractional parts
of a number respectively. It can be one ... | trusted_official_docs | CPython Docs | field size - in other words, how many characters will be used from the field content. The *precision* is not allowed for integer presentation types.
The *grouping* option after *width* and *precision* fields specifies
a digit group separator for the integral and fractional parts
of a number respectively. It can be one ... | field size - in other words, how many characters will be used from the field content. The *precision* is not allowed for integer presentation types.
The *grouping* option after *width* and *precision* fields specifies
a digit group separator for the integral and fractional parts
of a number respectively. It can be one ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0a1b0b2-b820-49a5-8f6b-d27a074f0bb9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,872 | supabase-export-v2 | 591f53aac2134e63 | or "label.title". *args* and *kwargs* are as passed in to :meth:`vformat`. The return value *used_key* has the same meaning as the *key* parameter to :meth:`get_value`.
.. method:: get_value(key, args, kwargs) | trusted_official_docs | CPython Docs | or "label.title". *args* and *kwargs* are as passed in to :meth:`vformat`. The return value *used_key* has the same meaning as the *key* parameter to :meth:`get_value`.
.. method:: get_value(key, args, kwargs) | or "label.title". *args* and *kwargs* are as passed in to :meth:`vformat`. The return value *used_key* has the same meaning as the *key* parameter to :meth:`get_value`.
.. method:: get_value(key, args, kwargs) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c0cf60ae-6973-4669-ba01-fcb19e5a0ea5 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,982 | supabase-export-v2 | cd871fac3e9788e1 | Using the comma or the underscore as a digit group separator::
>>> '{:,}'.format(1234567890)
'1,234,567,890'
>>> '{:_}'.format(1234567890)
'1_234_567_890'
>>> '{:_b}'.format(1234567890)
'100_1001_1001_0110_0000_0010_1101_0010'
>>> '{:_x}'.format(1234567890)
'4996_02d2'
>>> '{:_}'.format(123456789.123456789)
'1... | trusted_official_docs | CPython Docs | Using the comma or the underscore as a digit group separator::
>>> '{:,}'.format(1234567890)
'1,234,567,890'
>>> '{:_}'.format(1234567890)
'1_234_567_890'
>>> '{:_b}'.format(1234567890)
'100_1001_1001_0110_0000_0010_1101_0010'
>>> '{:_x}'.format(1234567890)
'4996_02d2'
>>> '{:_}'.format(123456789.123456789)
'1... | Using the comma or the underscore as a digit group separator::
>>> '{:,}'.format(1234567890)
'1,234,567,890'
>>> '{:_}'.format(1234567890)
'1_234_567_890'
>>> '{:_b}'.format(1234567890)
'100_1001_1001_0110_0000_0010_1101_0010'
>>> '{:_x}'.format(1234567890)
'4996_02d2'
>>> '{:_}'.format(123456789.123456789)
'1... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c164b0e6-9f98-45c0-9b22-4d5633fdfda0 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,929 | supabase-export-v2 | 168965e300211db4 | result of these conversions only if a digit follows it. In addition, for ``'g'`` and ``'G'`` conversions, trailing zeros are not removed from the result.
The *width* is a decimal integer defining the minimum total field width,
including any prefixes, separators, and other formatting characters. If not specified, then t... | trusted_official_docs | CPython Docs | result of these conversions only if a digit follows it. In addition, for ``'g'`` and ``'G'`` conversions, trailing zeros are not removed from the result.
The *width* is a decimal integer defining the minimum total field width,
including any prefixes, separators, and other formatting characters. If not specified, then t... | result of these conversions only if a digit follows it. In addition, for ``'g'`` and ``'G'`` conversions, trailing zeros are not removed from the result.
The *width* is a decimal integer defining the minimum total field width,
including any prefixes, separators, and other formatting characters. If not specified, then t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c34ab6fd-ae43-4d9e-9515-57f1759c792d | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,931 | supabase-export-v2 | e77a49c303ebd18e | (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of ``'0'`` with an *alignment* type of ``'='``.
.. versionchanged:: 3.10
Preceding the *width* field by ``'0'`` no longer affects the default
alignment for strings. | trusted_official_docs | CPython Docs | (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of ``'0'`` with an *alignment* type of ``'='``.
.. versionchanged:: 3.10
Preceding the *width* field by ``'0'`` no longer affects the default
alignment for strings. | (``'0'``) character enables sign-aware zero-padding for numeric types, excluding :class:`complex`. This is equivalent to a *fill* character of ``'0'`` with an *alignment* type of ``'='``.
.. versionchanged:: 3.10
Preceding the *width* field by ``'0'`` no longer affects the default
alignment for strings. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c6a3eede-d3cf-4a18-bd85-39e439c14172 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,925 | supabase-export-v2 | 54f93327620bfb1f | .. index:: single: z; in string formatting
The ``'z'`` option coerces negative zero floating-point values to positive
zero after rounding to the format precision. This option is only valid for
floating-point presentation types. | trusted_official_docs | CPython Docs | .. index:: single: z; in string formatting
The ``'z'`` option coerces negative zero floating-point values to positive
zero after rounding to the format precision. This option is only valid for
floating-point presentation types. | .. index:: single: z; in string formatting
The ``'z'`` option coerces negative zero floating-point values to positive
zero after rounding to the format precision. This option is only valid for
floating-point presentation types. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
c8f9c86b-090f-44b9-90cd-3ffd26e9ed1b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,920 | supabase-export-v2 | cced1b66f6f0a705 | | precedes the field width. | +---------+----------------------------------------------------------+ | ``'^'`` | Forces the field to be centered within the available | | | space. | +---------+----------------------------------------------------------+
Note that unless a minimum field width is defined, the field width w... | trusted_official_docs | CPython Docs | | precedes the field width. | +---------+----------------------------------------------------------+ | ``'^'`` | Forces the field to be centered within the available | | | space. | +---------+----------------------------------------------------------+
Note that unless a minimum field width is defined, the field width w... | | precedes the field width. | +---------+----------------------------------------------------------+ | ``'^'`` | Forces the field to be centered within the available | | | space. | +---------+----------------------------------------------------------+
Note that unless a minimum field width is defined, the field width w... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cce8d60e-34f8-4589-af78-2ff4d0288238 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,917 | supabase-export-v2 | 650f0de52ca313a8 | The meaning of the various alignment options is as follows:
.. index::
single: < (less); in string formatting
single: > (greater); in string formatting
single: = (equals); in string formatting
single: ^ (caret); in string formatting | trusted_official_docs | CPython Docs | The meaning of the various alignment options is as follows:
.. index::
single: < (less); in string formatting
single: > (greater); in string formatting
single: = (equals); in string formatting
single: ^ (caret); in string formatting | The meaning of the various alignment options is as follows:
.. index::
single: < (less); in string formatting
single: > (greater); in string formatting
single: = (equals); in string formatting
single: ^ (caret); in string formatting | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
cdece009-7041-49cb-ae96-169911fa45f9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,866 | supabase-export-v2 | a86d9fb309abe3fb | ``**kwargs`` syntax. :meth:`vformat` does the work of breaking up the format string into character data and replacement fields. It calls the various methods described below.
In addition, the :class:`Formatter` defines a number of methods that are
intended to be replaced by subclasses: | trusted_official_docs | CPython Docs | ``**kwargs`` syntax. :meth:`vformat` does the work of breaking up the format string into character data and replacement fields. It calls the various methods described below.
In addition, the :class:`Formatter` defines a number of methods that are
intended to be replaced by subclasses: | ``**kwargs`` syntax. :meth:`vformat` does the work of breaking up the format string into character data and replacement fields. It calls the various methods described below.
In addition, the :class:`Formatter` defines a number of methods that are
intended to be replaced by subclasses: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d27c7177-0a43-441a-ae8c-ffd82c92ddad | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,021 | supabase-export-v2 | 1fa5536677548aa5 | customize the placeholder syntax, delimiter character, or the entire regular expression used to parse template strings. To do this, you can override these class attributes:
* *delimiter* -- This is the literal string describing a placeholder
introducing delimiter. The default value is ``$``. Note that this should
*no... | trusted_official_docs | CPython Docs | customize the placeholder syntax, delimiter character, or the entire regular expression used to parse template strings. To do this, you can override these class attributes:
* *delimiter* -- This is the literal string describing a placeholder
introducing delimiter. The default value is ``$``. Note that this should
*no... | customize the placeholder syntax, delimiter character, or the entire regular expression used to parse template strings. To do this, you can override these class attributes:
* *delimiter* -- This is the literal string describing a placeholder
introducing delimiter. The default value is ``$``. Note that this should
*no... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d291d2dd-3f78-4f8c-aecd-5eb980b4f894 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,022 | supabase-export-v2 | 97f7c0d86e8fc812 | as needed. Note further that you cannot change the delimiter after class creation (i.e. a different delimiter must be set in the subclass's class namespace).
* *idpattern* -- This is the regular expression describing the pattern for
non-braced placeholders. The default value is the regular expression
``(?a:[_a-z][_a-... | trusted_official_docs | CPython Docs | as needed. Note further that you cannot change the delimiter after class creation (i.e. a different delimiter must be set in the subclass's class namespace).
* *idpattern* -- This is the regular expression describing the pattern for
non-braced placeholders. The default value is the regular expression
``(?a:[_a-z][_a-... | as needed. Note further that you cannot change the delimiter after class creation (i.e. a different delimiter must be set in the subclass's class namespace).
* *idpattern* -- This is the regular expression describing the pattern for
non-braced placeholders. The default value is the regular expression
``(?a:[_a-z][_a-... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d3eb81da-d2f1-4480-83a7-0830aa15bf94 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,903 | supabase-export-v2 | 5e1ee3449c48a277 | Some examples::
"Harold's a clever {0!s}" # Calls str() on the argument first
"Bring out the holy {name!r}" # Calls repr() on the argument first
"More {!a}" # Calls ascii() on the argument first | trusted_official_docs | CPython Docs | Some examples::
"Harold's a clever {0!s}" # Calls str() on the argument first
"Bring out the holy {name!r}" # Calls repr() on the argument first
"More {!a}" # Calls ascii() on the argument first | Some examples::
"Harold's a clever {0!s}" # Calls str() on the argument first
"Bring out the holy {name!r}" # Calls repr() on the argument first
"More {!a}" # Calls ascii() on the argument first | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
d400f278-57ed-46b6-b410-6a6abb85cc45 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,928 | supabase-export-v2 | 066ef36291149c3a | .. index:: single: # (hash); in string formatting
The ``'#'`` option causes the "alternate form" to be used for the
conversion. The alternate form is defined differently for different
types. This option is only valid for integer, float and complex
types. For integers, when binary, octal, or hexadecimal output
is used, ... | trusted_official_docs | CPython Docs | .. index:: single: # (hash); in string formatting
The ``'#'`` option causes the "alternate form" to be used for the
conversion. The alternate form is defined differently for different
types. This option is only valid for integer, float and complex
types. For integers, when binary, octal, or hexadecimal output
is used, ... | .. index:: single: # (hash); in string formatting
The ``'#'`` option causes the "alternate form" to be used for the
conversion. The alternate form is defined differently for different
types. This option is only valid for integer, float and complex
types. For integers, when binary, octal, or hexadecimal output
is used, ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
da07b50c-8457-42a3-9b6f-fc298e4fa704 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,921 | supabase-export-v2 | 99cc447359e6c7ee | field width will always be the same size as the data to fill it, so that the alignment option has no meaning in this case.
The *sign* option is only valid for number types, and can be one of the
following: | trusted_official_docs | CPython Docs | field width will always be the same size as the data to fill it, so that the alignment option has no meaning in this case.
The *sign* option is only valid for number types, and can be one of the
following: | field width will always be the same size as the data to fill it, so that the alignment option has no meaning in this case.
The *sign* option is only valid for number types, and can be one of the
following: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dbd9a9f5-9fa9-41b0-a896-3ee3cf66beb8 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,995 | supabase-export-v2 | 822ecd670e737c20 | than other built-in string formatting facilities in Python. As an example of a library built on template strings for i18n, see the `flufl.i18n <https://flufli18n.readthedocs.io/en/latest/>`_ package.
.. index:: single: $ (dollar); in template strings | trusted_official_docs | CPython Docs | than other built-in string formatting facilities in Python. As an example of a library built on template strings for i18n, see the `flufl.i18n <https://flufli18n.readthedocs.io/en/latest/>`_ package.
.. index:: single: $ (dollar); in template strings | than other built-in string formatting facilities in Python. As an example of a library built on template strings for i18n, see the `flufl.i18n <https://flufli18n.readthedocs.io/en/latest/>`_ package.
.. index:: single: $ (dollar); in template strings | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
dda458da-4244-42c5-b2e8-2599f532f77a | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,944 | supabase-export-v2 | 463358b73cea5718 | This is the default type for strings and | | | may be omitted. | +---------+----------------------------------------------------------+ | None | The same as ``'s'``. | +---------+----------------------------------------------------------+
The available integer presentation types are: | trusted_official_docs | CPython Docs | This is the default type for strings and | | | may be omitted. | +---------+----------------------------------------------------------+ | None | The same as ``'s'``. | +---------+----------------------------------------------------------+
The available integer presentation types are: | This is the default type for strings and | | | may be omitted. | +---------+----------------------------------------------------------+ | None | The same as ``'s'``. | +---------+----------------------------------------------------------+
The available integer presentation types are: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e10489c0-5d50-45ee-9eac-766cde9d1e99 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,926 | supabase-export-v2 | f5afccc72c1579a9 | ``'z'`` option coerces negative zero floating-point values to positive zero after rounding to the format precision. This option is only valid for floating-point presentation types.
.. versionchanged:: 3.11
Added the ``'z'`` option (see also :pep:`682`). | trusted_official_docs | CPython Docs | ``'z'`` option coerces negative zero floating-point values to positive zero after rounding to the format precision. This option is only valid for floating-point presentation types.
.. versionchanged:: 3.11
Added the ``'z'`` option (see also :pep:`682`). | ``'z'`` option coerces negative zero floating-point values to positive zero after rounding to the format precision. This option is only valid for floating-point presentation types.
.. versionchanged:: 3.11
Added the ``'z'`` option (see also :pep:`682`). | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e55c54e4-9ce1-4ca2-b59b-e1117bc38c8d | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,906 | supabase-export-v2 | c6ef64294efce60c | Most built-in types support a common formatting mini-language, which is described in the next section.
A *format_spec* field can also include nested replacement fields within it. These nested replacement fields may contain a field name, conversion flag
and format specification, but deeper nesting is
not allowed. The re... | trusted_official_docs | CPython Docs | Most built-in types support a common formatting mini-language, which is described in the next section.
A *format_spec* field can also include nested replacement fields within it. These nested replacement fields may contain a field name, conversion flag
and format specification, but deeper nesting is
not allowed. The re... | Most built-in types support a common formatting mini-language, which is described in the next section.
A *format_spec* field can also include nested replacement fields within it. These nested replacement fields may contain a field name, conversion flag
and format specification, but deeper nesting is
not allowed. The re... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e61c5486-ca80-42b7-a6d8-adfe28f6c91c | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,870 | supabase-export-v2 | cddeb08a7a70a12e | values of *field_name*, *format_spec* and *conversion* will be ``None``. The value of *field_name* is unmodified and auto-numbering of non-numbered positional fields is done by :meth:`vformat`.
.. method:: get_field(field_name, args, kwargs) | trusted_official_docs | CPython Docs | values of *field_name*, *format_spec* and *conversion* will be ``None``. The value of *field_name* is unmodified and auto-numbering of non-numbered positional fields is done by :meth:`vformat`.
.. method:: get_field(field_name, args, kwargs) | values of *field_name*, *format_spec* and *conversion* will be ``None``. The value of *field_name* is unmodified and auto-numbering of non-numbered positional fields is done by :meth:`vformat`.
.. method:: get_field(field_name, args, kwargs) | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6997fa3-201a-4471-96a9-b6c70a1a7c0e | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,889 | supabase-export-v2 | 1e435e564e725000 | unchanged to the output. If you need to include a brace character in the literal text, it can be escaped by doubling: ``{{`` and ``}}``.
The grammar for a replacement field is as follows: | trusted_official_docs | CPython Docs | unchanged to the output. If you need to include a brace character in the literal text, it can be escaped by doubling: ``{{`` and ``}}``.
The grammar for a replacement field is as follows: | unchanged to the output. If you need to include a brace character in the literal text, it can be escaped by doubling: ``{{`` and ``}}``.
The grammar for a replacement field is as follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e6a1126a-1970-4a92-9d9f-3dd3d76df739 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,876 | supabase-export-v2 | 512008ba7cbe9af8 | field names, these functions are only called for the first component of the field name; subsequent components are handled through normal attribute and indexing operations.
So for example, the field expression '0.name' would cause
:meth:`get_value` to be called with a *key* argument of 0. The ``name``
attribute will b... | trusted_official_docs | CPython Docs | field names, these functions are only called for the first component of the field name; subsequent components are handled through normal attribute and indexing operations.
So for example, the field expression '0.name' would cause
:meth:`get_value` to be called with a *key* argument of 0. The ``name``
attribute will b... | field names, these functions are only called for the first component of the field name; subsequent components are handled through normal attribute and indexing operations.
So for example, the field expression '0.name' would cause
:meth:`get_value` to be called with a *key* argument of 0. The ``name``
attribute will b... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
e9ba87a3-516a-4662-8029-91b413781baf | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,007 | supabase-export-v2 | 1f5493425e8b4872 | .. method:: safe_substitute(mapping={}, /, **kwds)
Like :meth:`substitute`, except that if placeholders are missing from
*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the
original placeholder will appear in the resulting string intact. Also,
unlike with :meth:`substitute`, any other appearanc... | trusted_official_docs | CPython Docs | .. method:: safe_substitute(mapping={}, /, **kwds)
Like :meth:`substitute`, except that if placeholders are missing from
*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the
original placeholder will appear in the resulting string intact. Also,
unlike with :meth:`substitute`, any other appearanc... | .. method:: safe_substitute(mapping={}, /, **kwds)
Like :meth:`substitute`, except that if placeholders are missing from
*mapping* and *kwds*, instead of raising a :exc:`KeyError` exception, the
original placeholder will appear in the resulting string intact. Also,
unlike with :meth:`substitute`, any other appearanc... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eaaf6cff-95c4-4eae-8153-d42328df4647 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,957 | supabase-export-v2 | ff00abb9f18131dc | is the same as | | | either ``'g'`` or ``'G'`` depending on the value of | | | ``context.capitals`` for the current decimal context.
|
| | |
| | The overall effect is to match the output of :func:`str` |
| | as altered by the other format modifiers. |
+---------+-----------------------------------------------------... | trusted_official_docs | CPython Docs | is the same as | | | either ``'g'`` or ``'G'`` depending on the value of | | | ``context.capitals`` for the current decimal context.
|
| | |
| | The overall effect is to match the output of :func:`str` |
| | as altered by the other format modifiers. |
+---------+-----------------------------------------------------... | is the same as | | | either ``'g'`` or ``'G'`` depending on the value of | | | ``context.capitals`` for the current decimal context.
|
| | |
| | The overall effect is to match the output of :func:`str` |
| | as altered by the other format modifiers. |
+---------+-----------------------------------------------------... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb5522ea-0687-460d-a084-571560ed85f9 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,956 | supabase-export-v2 | 7ec1c9586d6b44a6 | | +---------+----------------------------------------------------------+ | ``'%'`` | Percentage. Multiplies the number by 100 and displays | | | in fixed (``'f'``) format, followed by a percent sign.
|
+---------+----------------------------------------------------------+
| None | For :class:`float` this is like the ... | trusted_official_docs | CPython Docs | | +---------+----------------------------------------------------------+ | ``'%'`` | Percentage. Multiplies the number by 100 and displays | | | in fixed (``'f'``) format, followed by a percent sign.
|
+---------+----------------------------------------------------------+
| None | For :class:`float` this is like the ... | | +---------+----------------------------------------------------------+ | ``'%'`` | Percentage. Multiplies the number by 100 and displays | | | in fixed (``'f'``) format, followed by a percent sign.
|
+---------+----------------------------------------------------------+
| None | For :class:`float` this is like the ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eb59b873-40c1-41a9-8fa3-979e075c0ba7 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,916 | supabase-export-v2 | 6f83f3fb8249e316 | using the :meth:`str.format` method. However, it is possible to insert a curly brace with a nested replacement field. This limitation doesn't affect the :func:`format` function.
The meaning of the various alignment options is as follows: | trusted_official_docs | CPython Docs | using the :meth:`str.format` method. However, it is possible to insert a curly brace with a nested replacement field. This limitation doesn't affect the :func:`format` function.
The meaning of the various alignment options is as follows: | using the :meth:`str.format` method. However, it is possible to insert a curly brace with a nested replacement field. This limitation doesn't affect the :func:`format` function.
The meaning of the various alignment options is as follows: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
eda65129-c6c3-4c1c-ac14-75e7e27fde22 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,919 | supabase-export-v2 | 50ee29b2a4100663 | used for printing fields | | | in the form '+000000120'. This alignment option is only | | | valid for numeric types, excluding :class:`complex`.
|
| | It becomes the default for numbers when '0' immediately |
| | precedes the field width. |
+---------+----------------------------------------------------------+
| ``'^'... | trusted_official_docs | CPython Docs | used for printing fields | | | in the form '+000000120'. This alignment option is only | | | valid for numeric types, excluding :class:`complex`.
|
| | It becomes the default for numbers when '0' immediately |
| | precedes the field width. |
+---------+----------------------------------------------------------+
| ``'^'... | used for printing fields | | | in the form '+000000120'. This alignment option is only | | | valid for numeric types, excluding :class:`complex`.
|
| | It becomes the default for numbers when '0' immediately |
| | precedes the field width. |
+---------+----------------------------------------------------------+
| ``'^'... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
ee4fff7e-28a7-461c-81b5-632dedbb3d12 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,981 | supabase-export-v2 | 610694af596057d7 | # with 0x, 0o, or 0b as prefix: >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42) 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'
Using the comma or the underscore as a digit group separator:: | trusted_official_docs | CPython Docs | # with 0x, 0o, or 0b as prefix: >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42) 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'
Using the comma or the underscore as a digit group separator:: | # with 0x, 0o, or 0b as prefix: >>> "int: {0:d}; hex: {0:#x}; oct: {0:#o}; bin: {0:#b}".format(42) 'int: 42; hex: 0x2a; oct: 0o52; bin: 0b101010'
Using the comma or the underscore as a digit group separator:: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f07e4093-a3ad-4cce-98a6-1d4af3fed84d | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 12,008 | supabase-export-v2 | e41b52c662edf984 | will appear in the resulting string intact. Also, unlike with :meth:`substitute`, any other appearances of the ``$`` will simply return ``$`` instead of raising :exc:`ValueError`.
While other exceptions may still occur, this method is called "safe"
because it always tries to return a usable string instead of
raising ... | trusted_official_docs | CPython Docs | will appear in the resulting string intact. Also, unlike with :meth:`substitute`, any other appearances of the ``$`` will simply return ``$`` instead of raising :exc:`ValueError`.
While other exceptions may still occur, this method is called "safe"
because it always tries to return a usable string instead of
raising ... | will appear in the resulting string intact. Also, unlike with :meth:`substitute`, any other appearances of the ``$`` will simply return ``$`` instead of raising :exc:`ValueError`.
While other exceptions may still occur, this method is called "safe"
because it always tries to return a usable string instead of
raising ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f7ddf3ed-6583-49a7-931e-05ac3256cf2f | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,865 | supabase-export-v2 | 815aff5e8a8ef57c | .. 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
dictionary as individual arguments using the ``*args`` and ``**kwar... | trusted_official_docs | CPython Docs | .. 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
dictionary as individual arguments using the ``*args`` and ``**kwar... | .. 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
dictionary as individual arguments using the ``*args`` and ``**kwar... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
f8c375bc-8f8d-4d92-b8df-7b4526f38409 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,937 | supabase-export-v2 | 891d748f0194b0a2 | | | underscores are inserted every 4 digits. | | | For other presentation types, | | | this option is not supported. | +---------+----------------------------------------------------------+
For a locale aware separator, use the ``'n'`` presentation type instead. | trusted_official_docs | CPython Docs | | | underscores are inserted every 4 digits. | | | For other presentation types, | | | this option is not supported. | +---------+----------------------------------------------------------+
For a locale aware separator, use the ``'n'`` presentation type instead. | | | underscores are inserted every 4 digits. | | | For other presentation types, | | | this option is not supported. | +---------+----------------------------------------------------------+
For a locale aware separator, use the ``'n'`` presentation type instead. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fb121ba8-15de-4217-93c1-a96dfe284e7b | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,895 | supabase-export-v2 | c431debbdfc79268 | An expression of the form ``'.name'`` selects the named attribute using :func:`getattr`, while an expression of the form ``'[index]'`` does an index lookup using :meth:`~object.__getitem__`.
.. versionchanged:: 3.1
The positional argument specifiers can be omitted for :meth:`str.format`,
so ``'{} {}'.format(a, b)`` i... | trusted_official_docs | CPython Docs | An expression of the form ``'.name'`` selects the named attribute using :func:`getattr`, while an expression of the form ``'[index]'`` does an index lookup using :meth:`~object.__getitem__`.
.. versionchanged:: 3.1
The positional argument specifiers can be omitted for :meth:`str.format`,
so ``'{} {}'.format(a, b)`` i... | An expression of the form ``'.name'`` selects the named attribute using :func:`getattr`, while an expression of the form ``'[index]'`` does an index lookup using :meth:`~object.__getitem__`.
.. versionchanged:: 3.1
The positional argument specifiers can be omitted for :meth:`str.format`,
so ``'{} {}'.format(a, b)`` i... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fe800bb8-a7b0-42ab-8bca-ae412d20f7bf | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,915 | supabase-export-v2 | 657bf02f5ced50dc | | "e" | "E" | "f" | "F" | "g" : | "G" | "n" | "o" | "s" | "x" | "X" | "%"
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. It is not possible to use a literal curly brace ("``{``" or "``}``") as
the *fill* character in a :ref:`... | trusted_official_docs | CPython Docs | | "e" | "E" | "f" | "F" | "g" : | "G" | "n" | "o" | "s" | "x" | "X" | "%"
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. It is not possible to use a literal curly brace ("``{``" or "``}``") as
the *fill* character in a :ref:`... | | "e" | "E" | "f" | "F" | "g" : | "G" | "n" | "o" | "s" | "x" | "X" | "%"
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. It is not possible to use a literal curly brace ("``{``" or "``}``") as
the *fill* character in a :ref:`... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
fff0fe55-0083-4145-9d3a-44f36f10f5b5 | CPython Docs | file://datasets/cpython/Doc/library/string.rst | unknown | c08b4150-d3a9-400e-a929-bb83517af870 | 11,893 | supabase-export-v2 | 633f6a32fb94ad30 | See also the :ref:`formatspec` section.
The *field_name* itself begins with an *arg_name* that is either a number or a
keyword. If it's a number, it refers to a positional argument, and if it's a keyword,
it refers to a named keyword argument. An *arg_name* is treated as a number if
a call to :meth:`str.isdecimal` on t... | trusted_official_docs | CPython Docs | See also the :ref:`formatspec` section.
The *field_name* itself begins with an *arg_name* that is either a number or a
keyword. If it's a number, it refers to a positional argument, and if it's a keyword,
it refers to a named keyword argument. An *arg_name* is treated as a number if
a call to :meth:`str.isdecimal` on t... | See also the :ref:`formatspec` section.
The *field_name* itself begins with an *arg_name* that is either a number or a
keyword. If it's a number, it refers to a positional argument, and if it's a keyword,
it refers to a named keyword argument. An *arg_name* is treated as a number if
a call to :meth:`str.isdecimal` on t... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0108d6b5-4435-44e4-ab91-4d293da05def | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,362 | supabase-export-v2 | bfc32cffa64a9af8 | dictionary, which is accessible via the :attr:`data` attribute of :class:`!UserDict` instances. If arguments are provided, they are used to initialize :attr:`data`, like a regular dictionary.
In addition to supporting the methods and operations of mappings,
:class:`!UserDict` instances provide the following attribute: | trusted_official_docs | CPython Docs | dictionary, which is accessible via the :attr:`data` attribute of :class:`!UserDict` instances. If arguments are provided, they are used to initialize :attr:`data`, like a regular dictionary.
In addition to supporting the methods and operations of mappings,
:class:`!UserDict` instances provide the following attribute: | dictionary, which is accessible via the :attr:`data` attribute of :class:`!UserDict` instances. If arguments are provided, they are used to initialize :attr:`data`, like a regular dictionary.
In addition to supporting the methods and operations of mappings,
:class:`!UserDict` instances provide the following attribute: | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
01100e74-32da-4f68-83ae-a7681e58ccf0 | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,312 | supabase-export-v2 | 3d5763a83bbac965 | * The regular :class:`dict` was designed to be very good at mapping operations. Tracking insertion order was secondary.
* The :class:`OrderedDict` was designed to be good at reordering operations. Space efficiency, iteration speed, and the performance of update
operations were secondary. | trusted_official_docs | CPython Docs | * The regular :class:`dict` was designed to be very good at mapping operations. Tracking insertion order was secondary.
* The :class:`OrderedDict` was designed to be good at reordering operations. Space efficiency, iteration speed, and the performance of update
operations were secondary. | * The regular :class:`dict` was designed to be very good at mapping operations. Tracking insertion order was secondary.
* The :class:`OrderedDict` was designed to be good at reordering operations. Space efficiency, iteration speed, and the performance of update
operations were secondary. | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
032bacef-78b4-400c-a745-42b99b89041f | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,336 | supabase-export-v2 | b3a8dcde5cb1fe41 | Equality tests between :class:`OrderedDict` objects are order-sensitive and are roughly equivalent to ``list(od1.items())==list(od2.items())``.
Equality tests between :class:`OrderedDict` objects and other
:class:`~collections.abc.Mapping` objects are order-insensitive like regular
dictionaries. This allows :class:`Ord... | trusted_official_docs | CPython Docs | Equality tests between :class:`OrderedDict` objects are order-sensitive and are roughly equivalent to ``list(od1.items())==list(od2.items())``.
Equality tests between :class:`OrderedDict` objects and other
:class:`~collections.abc.Mapping` objects are order-insensitive like regular
dictionaries. This allows :class:`Ord... | Equality tests between :class:`OrderedDict` objects are order-sensitive and are roughly equivalent to ``list(od1.items())==list(od2.items())``.
Equality tests between :class:`OrderedDict` objects and other
:class:`~collections.abc.Mapping` objects are order-insensitive like regular
dictionaries. This allows :class:`Ord... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
05d65681-17aa-4d33-857f-4f9312305abc | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,064 | supabase-export-v2 | ca36afc4c9a850c0 | .. attribute:: parents
Property returning a new :class:`ChainMap` containing all of the maps in
the current instance except the first one. This is useful for skipping
the first map in the search. Use cases are similar to those for the
:keyword:`nonlocal` keyword used in :term:`nested scopes <nested
scope>`. The use... | trusted_official_docs | CPython Docs | .. attribute:: parents
Property returning a new :class:`ChainMap` containing all of the maps in
the current instance except the first one. This is useful for skipping
the first map in the search. Use cases are similar to those for the
:keyword:`nonlocal` keyword used in :term:`nested scopes <nested
scope>`. The use... | .. attribute:: parents
Property returning a new :class:`ChainMap` containing all of the maps in
the current instance except the first one. This is useful for skipping
the first map in the search. Use cases are similar to those for the
:keyword:`nonlocal` keyword used in :term:`nested scopes <nested
scope>`. The use... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0642212c-b3a1-476e-9b5c-3fd20f976d11 | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,318 | supabase-export-v2 | bc91c52ca1e860d7 | A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item.
A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)``
with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the
leftmost (first) ... | trusted_official_docs | CPython Docs | A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item.
A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)``
with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the
leftmost (first) ... | A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=True)`` with ``d.popitem()`` which is guaranteed to pop the rightmost (last) item.
A regular :class:`dict` can emulate OrderedDict's ``od.popitem(last=False)``
with ``(k := next(iter(d)), d.pop(k))`` which will return and remove the
leftmost (first) ... | python, official-docs, cpython, P0 | Local_Trusted_Corpus | |
0826a28e-1409-4560-ad4e-071f90802b3b | CPython Docs | file://datasets/cpython/Doc/library/collections.rst | unknown | 0f4e51ec-13d3-4fa3-b76a-63704d522acd | 12,049 | supabase-export-v2 | 4317d4c6bce8f5f9 | .. versionadded:: 3.3
A :class:`ChainMap` class is provided for quickly linking a number of mappings
so they can be treated as a single unit. It is often much faster than creating
a new dictionary and running multiple :meth:`~dict.update` calls. | trusted_official_docs | CPython Docs | .. versionadded:: 3.3
A :class:`ChainMap` class is provided for quickly linking a number of mappings
so they can be treated as a single unit. It is often much faster than creating
a new dictionary and running multiple :meth:`~dict.update` calls. | .. versionadded:: 3.3
A :class:`ChainMap` class is provided for quickly linking a number of mappings
so they can be treated as a single unit. It is often much faster than creating
a new dictionary and running multiple :meth:`~dict.update` calls. | python, official-docs, cpython, P0 | Local_Trusted_Corpus |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.