[Django]-Issue in printing dictionary value in django

3👍

You are not using the context properly. param is the dictionary that you are passing, and you will be able to use the keys of param to access the values. Try using the following code:

param = {'param': {li_title[i] : a_href[i] for i in range(len(li_title))}}

In this way you will be able to use param to access the associated value.

In your template:

{% for i,j in param.items %}
    {{j}}
{% endfor %}

Leave a comment