Last active
September 18, 2024 14:55
-
-
Save jamescarr/0205f889e1a87157fb941a54beb257db to your computer and use it in GitHub Desktop.
Test jinja2 out in a console quickly. If you have jinja2 installed locally just open a python REPL and do this!
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 jinja2 import Template | |
text = """ | |
hi {{ name|default(other_name) }} | |
""" | |
template = Template(text) | |
template.render(name="foo") # passing variables here to the text template if needed | |
template.render(other_name="bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment