File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -23,10 +23,13 @@ Template strings
2323
2424.. versionadded :: 3.14
2525
26- Template strings are an extension of :ref: `f-strings <f-strings >`
27- that allow for greater control of formatting behavior. The :class: `Template `
28- class gives you access to the static and interpolated (in curly braces)
29- parts of a string *before * they are combined into a final string.
26+ Template strings are a formatting mechanism that allows for deep control over
27+ how strings are processed. You can create Templates using
28+ :ref: `t-string literal syntax <t-strings >`, which is identical to
29+ :ref: `f-string syntax <f-strings >` but uses a ``t `` instead of an ``f ``.
30+ While f-strings evaluate to ``str ``, t-strings create a :class: `Template `
31+ instance that gives you access to the static and interpolated (in curly braces)
32+ parts of a string *before * they are combined.
3033
3134See the :ref: `t-strings tutorial <tut-t-strings >` for an introduction.
3235
@@ -50,7 +53,7 @@ reassigned.
5053
5154 The most common way to create a :class: `!Template ` instance is to use the
5255 :ref: `t-string literal syntax <t-strings >`. This syntax is identical to that of
53- :ref: `f-strings ` except that it uses a ``t `` instead of an ``f ``:
56+ :ref: `f-strings < f-strings > ` except that it uses a ``t `` instead of an ``f ``:
5457
5558 >>> name = " World"
5659 >>> template = t" Hello {name} !"
You can’t perform that action at this time.
0 commit comments