You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
special-issue-11-wiki2html/sandbox/jinja_tutorial.py

15 lines
483 B
Python

import os
from jinja2 import Template
wd = os.path.dirname(os.path.abspath(__file__)) # working directory
# read template files
with open(os.path.join(wd, '../templates/scatch.html')) as document_html:
template = Template(document_html.read())
imgs_list = ['images/01.jpg', 'images/02.jpg', 'images/03.jpg']
template_render = template.render(title=':) Hello Sandra',
imgs=imgs_list
)
print(template_render)