mirror of
https://github.com/python/cpython.git
synced 2025-12-08 06:10:17 +00:00
[3.14] gh-132661: PEP 750 documentation: second pass (GH-137020) (#137392)
gh-132661: PEP 750 documentation: second pass (GH-137020)
(cherry picked from commit 4dae9b1ff1)
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
This commit is contained in:
parent
7b56d08219
commit
e817d1aa2b
8 changed files with 321 additions and 279 deletions
|
|
@ -95,11 +95,11 @@ Some examples::
|
|||
>>> repr((x, y, ('spam', 'eggs')))
|
||||
"(32.5, 40000, ('spam', 'eggs'))"
|
||||
|
||||
The :mod:`string` module also contains support for so-called
|
||||
:ref:`$-strings <template-strings-pep292>` that offer yet another way to
|
||||
substitute values into strings, using placeholders like ``$x`` and replacing
|
||||
them with values from a dictionary. This syntax is easy to use, although
|
||||
it offers much less control of the formatting.
|
||||
The :mod:`string` module contains support for a simple templating approach
|
||||
based upon regular expressions, via :class:`string.Template`.
|
||||
This offers yet another way to substitute values into strings,
|
||||
using placeholders like ``$x`` and replacing them with values from a dictionary.
|
||||
This syntax is easy to use, although it offers much less control for formatting.
|
||||
|
||||
.. index::
|
||||
single: formatted string literal
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue