I am sending one list of list to my HTML page, using flask jinja2 template. I want to check:- is item in list is of type str or not ?. But getting an exception of
jinja2.exceptions.UndefinedError: 'isinstance' is undefined
Code is as below:-
{% for i in req%}
<tr>
<th scope="row">{{loop.index}}</th>
<td>{{i[1]}}</td>
<td>{{i[24]}}</td>
<td>{{i[49]}}</td>
<td>{{i[53]}}</td>
{% if isinstance(i[86], str) %}
{% for j in i[86].split(",") %}
<ol>
<li>{{i[86]}}</li>
</ol>
{% endfor %}
{% else %}
<td>{{i[86]}}</td>
{% endif %}
</tr>
{% endfor %}
I am able to use split(",")
function and Want to use isinstance()
or str()
of python in jinja 2 template.