小编Gan*_*a U的帖子

Django模板中的字典查找

{% for dispN0, tableDataSet0 in tabulatedTable.items %}
    {% for dispN in orderChanels %}     
        {% for antenaName, antenaLevel in tableDataSet0.{{dispN}}.items %}  
             <td>{{antenaName}}</td>    
        {% endfor %}
    {% endfor %}
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

这里{{dispN}}是整数,数字将如36、42等出现。如果我给tableDataSet0.36.items,它可以正常工作。但我需要在36处乘以倍数。

python django django-templates python-2.7

5
推荐指数
1
解决办法
789
查看次数

标签 统计

django ×1

django-templates ×1

python ×1

python-2.7 ×1