2012-04-17 77 views

回答

4
{% if some_dict %} 
    Some (k, v) - {{ some_dict.items.0 }} 
{% endif %} 

请注意,Python字典是无序的,所以没有“第一个”k-v对。

你确定模板是这个逻辑的好地方吗?我不是。

相关问题