1

I need is to display the list below in index.html file.

print (stock_info)

[{'symbol': 'AAPL', 'name': 'Apple Inc.', 'price': 145.16, 'quantity': 20}, {'symbol': 'AMZN', 'name': 'Amazon.com, Inc.', 'price': 998.61,* 'quantity': 20*}, {'symbol': 'FB', 'name': 'Facebook, Inc.', 'price': 152.96, 'quantity': 30}, {'symbol': 'GOOG', 'name': 'Alphabet Inc.', 'price': 957.01, 'quantity': 20}]

Any help is greatly appreciated ;)

1

Solution

{% for stock in stocks %}
        <tr>
            <td> {{ stock.symbol }} </td>
            <td> {{ stock.name }} </td>
            <td> {{ stock.quantity }} </td>
            <td> {{ stock.price }} </td>

        </tr>    
{% endfor %}

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .