Python 3.14 Introduces Template Strings: Safer String Processing Beyond f-strings
2025-04-10

Python 3.14 introduces template strings (t-strings), extending f-strings to allow developers to access and transform values before string interpolation. This prevents security vulnerabilities like SQL injection and XSS. T-strings resolve to a new `Template` object containing string parts and interpolation expressions, enabling custom processing such as HTML sanitization and structured logging. This enhancement provides Python with more flexible and secure string handling and opens new possibilities for building sophisticated DSLs and templating engines.
Development
template strings