Present data from python dictionary to django template.?

后端 未结 3 983
粉色の甜心
粉色の甜心 2021-02-04 08:08

I have a dictionary

data = {\'sok\': [ [1, 10] ], \'sao\': [ [1, 10] ],\'sok&sao\':[ [2,20]] }

How Can I (Loop trough Dictionary ) pres

3条回答
  •  死守一世寂寞
    2021-02-04 08:53

    You can use the dict.items() method to get the dictionary elements:

    
    
        {% for author, values in data.items %}
        
            {% for v in values.0 %}
            
            {% endfor %}
        
        {% endfor %}
    
    author qty Amount
    {{author}}{{v}}

提交回复
热议问题