Skip to content Skip to sidebar Skip to footer

How Do I Iterate Zip List In Jinja2 Using For Loop And Display Values In Html Table?

I was trying to iterate zip list in jinja2 and display values in HTML table but failed at every single try with a blank page, however, I can display values in the Unordered list li

Solution 1:

you don't have the

<tbody> </tbody> 

tag in your page i added it and it works:

<tablestyle="width:100%"><tr><th>Bus Type</th><th>Bus Information</th></tr><tbody>
    {% for bus, info  in jnjbus_info %}
        <tr><td>{{bus}}</td><td>{{info}}</td></tr>
        {% endfor %}
    </tbody></table>

here is how it looks like :

enter image description here

Solution 2:

The code provided in this question is bug-free, however, the problem caused by port=5000 and may be browser cache as well. While tackling with the bug I have written a similar script py and html and screen shot .and ran on port=8888 which works like charm. Note : consider running the same application on different ports and clearing browser cache.

Post a Comment for "How Do I Iterate Zip List In Jinja2 Using For Loop And Display Values In Html Table?"