from jinja2 import Template
positions = [
{
"title": "Head of web development department",
"salary": "180,000 - 200,000",
"level": "lead",
"tags": ["OOP", "Git", "Flask", "Redis", "Project Management", "People Management",
"Team Building", "Negotiating"],
}
]
templ = Template("""
{% for k in positions %}
<div>
<h3>{{ k.title }}</h3>
<p>{{k.salary}}</p>
<ul>
{% for tags_inside in k.tags %}
<li>{{tags_inside}}</li>
{% endfor %}
</ul>
</div>
{% endfor %}
""")
print(templ.render(positions=positions))
output
<div>
<h3>Head of web development department</h3>
<p>180,000 - 200,000</p>
<ul>
<li>OOP</li>
<li>Git</li>
<li>Flask</li>
<li>Redis</li>
<li>Project Management</li>
<li>People Management</li>
<li>Team Building</li>
<li>Negotiating</li>
</ul>
</div>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…