Created
August 30, 2025 17:03
-
-
Save everythingpython/1ea13054690eefdfed25b754320e55a2 to your computer and use it in GitHub Desktop.
Print t-string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from string.templatelib import Template | |
| def render_plain(template: Template) -> str: | |
| parts = [] | |
| # interleave strings and interpolation values | |
| for literal, value in zip(template.strings, template.values + ("",)): | |
| parts.append(literal) | |
| parts.append(str(value)) | |
| return "".join(parts) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment