mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Issue #25179: Documentation for formatted string literals aka f-strings
Some of the inspiration and wording is taken from the text of PEP 498 by Eric V. Smith, and the existing str.format() documentation.
This commit is contained in:
parent
e0b23095ee
commit
bc1ee460dc
10 changed files with 158 additions and 21 deletions
|
@ -25,7 +25,8 @@ first way is to do all the string handling yourself; using string slicing and
|
|||
concatenation operations you can create any layout you can imagine. The
|
||||
string type has some methods that perform useful operations for padding
|
||||
strings to a given column width; these will be discussed shortly. The second
|
||||
way is to use the :meth:`str.format` method.
|
||||
way is to use :ref:`formatted string literals <f-strings>`, or the
|
||||
:meth:`str.format` method.
|
||||
|
||||
The :mod:`string` module contains a :class:`~string.Template` class which offers
|
||||
yet another way to substitute values into strings.
|
||||
|
|
|
@ -352,6 +352,9 @@ The built-in function :func:`len` returns the length of a string::
|
|||
Strings support a large number of methods for
|
||||
basic transformations and searching.
|
||||
|
||||
:ref:`f-strings`
|
||||
String literals that have embedded expressions.
|
||||
|
||||
:ref:`formatstrings`
|
||||
Information about string formatting with :meth:`str.format`.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue