@videlais/

Learning Jinja2: Part 5: Control Blocks

Python

No description

fork
loading
Files
  • main.py
  • templates
  • requirements.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
from jinja2 import Template, Environment, FileSystemLoader

env = Environment(loader = FileSystemLoader('templates/'))

template = env.get_template("task.html")

fruits = ["Apples", "Pears", "Grapefruits", "Limes"]

result = template.render(fruits = fruits)

print(result)