Creating an ordered list out of a python list item

html, jinja2, python

Solution

It is actually a problem with your html (and not python / jinja). It you remove the `tr`/`td` tags it will be ok.

Update: If you insist on using the table tags, drop the `ol`/`li` tags, and use the `loop` object that is implicitly defined in the jinja `for` loop. That is,

<td>{{loop.index}}. {{item}}</td>

will give you enumerated item.

Problem

Have a list called `whatever` that I want to itemize in Jinja: ``` <ol> {% for item in whatever %} <tr> <td> <li> {{ item }}</li> </td> </tr> {% endfor %} </ol> ``` However, when I implement this in this way, I get unordered list output rather than sequential numbers, i.e. - item 1 - item 2 - etc. rather than - item 1 - item 2 - etc.

Original source