Version-Specific Features

Python 3.14 — Template string literals

Unlike f-strings, t-strings produce a Template containing literal segments and interpolation objects rather than a finished string. A consumer chooses how to render or escape the values; the syntax does not automatically make SQL or HTML safe. Requires Python 3.14 or the relevant build; example is not executed locally.

Formal Syntax & Structure

python syntaxpython
t"...{expression}..."

Return Value

Feature-specific

No single return type; see the example and feature description.

Working Example

Example Snippetpython
name = 'Ada'template = t'Hello {name}'print(template.strings)print(template.interpolations[0].value)
Python Reference