Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to I access the dictionary with multiple values inside list

my_isp_details = {'Jim': ['10.1387.32', 'Sim782']}

<table>
      <tr>
        <th>Description</th>
        <th>Source</th>
        <th>Gateway</th>
      </tr>
      {% for key, value in my_isp_details.items %}
      <tr>
        <td>{{ key }}</td>
        <td>{{ value[0] }}</td>
        <td>{{ value[1] }}</td>
      </tr>
      {% endfor %}
    </table>

How to pass the value 0 and 1 in table td. Is there any solution to pass the values

>Solution :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

I think you are looking to iterate over the items in your value perhaps like this:

my_isp_details = {'Jim': ['10.1387.32', 'Sim782']}

<table>
    <tr>
        <th>Description</th>
        <th>Source</th>
        <th>Gateway</th>
    </tr>
    {% for key, value in my_isp_details.items %}
        <tr>
            <td>{{ key }}</td>
            {% for inner_value in value %}
                <td>{{ inner_value }}</td>
            {% endfor %}
        </tr>
    {% endfor %}
</table>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading