我有一个原始的SQL输出,其中也包含一些数组。我想解析这些行并遍历其中的数组。你知道吗
我写了以下代码:
{% for row in in results %}
<li>Title : {{row.4}}</li>
<li>Description :{{ row.2}}</li>
{% for i in row.3|length|range %}
<li class="bs-callout">
<button id="{{row.3.forloop.counter0}}">{{row.4.forloop.counter0}}</button>
<span>{{row.5.forloop.counter0}}</span>
</li>
{% endfor%}
{% endfor %}
样本行:
['Col1','Col2',['txt1','txt2','txt3'],['txt1','txt2','txt3'],['txt1','txt2','txt3']]
在本例中,row[5],row[6],row[7]
是包含5-7个值的数组。
对于每一行,我想打印row[4]
中的标题并列出数组项。你知道吗
我不知道这样做是否正确。但这是唯一对我有用的东西。你知道吗
其中getitem是一个自定义筛选器。你知道吗
相关问题 更多 >
编程相关推荐