[3.14] gh-132661: Document t-strings and templatelib (GH-135229) (#136974)

Co-authored-by: Dave Peck <davepeck@gmail.com>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Co-authored-by: Loïc Simon <loic.pano@gmail.com>
Co-authored-by: pauleveritt <pauleveritt@me.com>
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
This commit is contained in:
Miss Islington (bot) 2025-07-22 12:32:00 +02:00 committed by GitHub
parent d118bc061b
commit c59a60bdb4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 488 additions and 23 deletions

View file

@ -95,10 +95,11 @@ Some examples::
>>> repr((x, y, ('spam', 'eggs')))
"(32.5, 40000, ('spam', 'eggs'))"
The :mod:`string` module contains a :class:`~string.Template` class that offers
yet another way to substitute values into strings, using placeholders like
``$x`` and replacing them with values from a dictionary, but offers much less
control of the formatting.
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.
.. index::
single: formatted string literal