Like f-strings, you can put expressions inside
{}
, but instead of evaluating to a string immediately, it creates a string.templatelib.Template
objectThis Template object provides the original string fragments and variable values separately through the
.strings
and .values
properties, allowing developers to safely escape or post-process them as needed.