I am trying to extract data from the following HTML code
<html>
<body>
Other Contents here that I dont care about
<ul class="normalDays">
<li>
<span>
Monday
</span>
8:00 to 18:00
</li>
<li>
<span>
Friday
</span>
8:00 to 18:00
</li>
<!-- Other days as well -->
</ul>
</body>
</html>
I want to extract data from this code snippet. I want to extract the day and the hours corresponding to it. So far I have tried this in Python
trade=i.find("ul",{"class":"normalDays"})
day=trade.find_all("span")
for dy in day:
if dy.string=='Monday':
print(dy.string+":"+str(dy.parent.text.replace("Monday","")))
But I want to extract the data without the need of putting if conditions for 7 days. How can I extract the days and the times directly from the HTML code and assign the time to the day and then put it in a dictionary where keys are days Monday to Sunday and values are the time?