I recently coded a script that scrapes headlines and images off of https://thestar.com ( The Toronto Star ), It takes the first 10 h3 elements from the site and the corresponding images ( 10 img elements ), and displays them on my news aggregator website.
However , my index.html file is having a problem.
As you can see, instead of displaying the images in order by its corresponding headline, its just displaying ALL of the images in every single headline.
All i need is for each image from the 10 images seen in the screenshot i put up above to show one by one in order next to each headline.
Here's the code for the container element that is displaying the headlines and images in my html file :
<div class="col-6">
<center><i><u><h3 class="text-centre">Live News from The Toronto Star</h3></u></i></center>
{% for n in toi_news %}
<strong><h5>{{n}}</h5></strong>
{% for i in images %}
<img src="{{i}}">
{% endfor %}
<hr>
{% endfor %}
<br>
</div>
Can anyone help me? Any help would be greatly appreciated.
