Question 7
Consider the template code and Python code given below:
Template code: “output.html”
<!DOCTYPE html><html lang="en"><head></head><body> <ol> {%for p in products%} {%if "i" in p.name|string %} <li>{{p.id}}, {{p.name}}, {{p.qty}}, {{p.price}}</li> {%endif%} {%endfor%} </ol></body></html>Python code: “main.py”
from jinja2 import Template
products = [ {"id": "101", "name": "Food", "qty": 78, "price": 100}, {"id": "102", "name": "Electrical", "qty": 4, "price": 16}, {"id": "103", "name": "Stationary", "qty": 7, "price": 14}, {"id": "104", "name": "Electronics", "qty": 10, "price": 145},]
with open("output.html") as r: t = Template(r.read()) print(t.render(products=products))What will the output of the above Python code be?