t = env.from_string(
    """
{% for field in fields %}
<td> {{ item[field] }} </td>
{% endfor %}""")
print(next(t.generate(item={'key': 'value'}, fields=['key'])))
Jinja2 dictonary lookup using a variable key