Skip to content

Instantly share code, notes, and snippets.

@epcim
Forked from SEJeff/gist:4207694
Last active May 5, 2017 11:35
Show Gist options
  • Save epcim/fde8c4869fd179e03cfbfefb36c061c0 to your computer and use it in GitHub Desktop.
Save epcim/fde8c4869fd179e03cfbfefb36c061c0 to your computer and use it in GitHub Desktop.
Testing jinja from the python interactive shell
from jinja2 import Template
tmpl = """{% if name != "Jeff" %}Nothing to see here move along{% else %} ... hello {{name}}, how are you?{% endif %}"""
template = Template(tmpl)
print template.render({"name": "Jeff"})
# hello Jeff, how are you?
print template.render({"name": "John"})
# Nothing to see here move along
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment