Skip to content

Instantly share code, notes, and snippets.

@everythingpython
Created August 30, 2025 17:03
Show Gist options
  • Select an option

  • Save everythingpython/1ea13054690eefdfed25b754320e55a2 to your computer and use it in GitHub Desktop.

Select an option

Save everythingpython/1ea13054690eefdfed25b754320e55a2 to your computer and use it in GitHub Desktop.
Print t-string
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