My Hackpact entries here
25 09 2019
try to use Jinja to generate repetitive tags and id in html page.
from jinja2 import Template
images_html=Template('''<img>
{% for image in images %}
<img class="image" id=images_{{ image }}></img>
{% endfor %}
''')
names = ["1", "2", "3", "4", "5", "6", "7"]
images_list=images_html.render(images=names)
print(images_list)
output is:
<img class="image" id=images_1></img>
<img class="image" id=images_2></img>
<img class="image" id=images_3></img>
<img class="image" id=images_4></img>
<img class="image" id=images_5></img>
<img class="image" id=images_6></img>
<img class="image" id=images_7></img>