#!/usr/bin/env python
# -*- coding:utf-8 -*-
from jinja2 import Template
import sys
tmpl = """
{% for link in links %}
{{ loop.index0 }}: {{link.name}}
{{ loop.index }}: {{link.name}}
{% endfor %}
"""
if __name__ == '__main__':
links = [
{'name': 'Google', 'href': 'https://www.google.com'},
{'name': 'Facebook', 'href': 'https://www.facebook.com'}
]
t = Template(tmpl)
sys.stdout.write(t.render(links=links))