Issue
I am trying to figure out how to find the child tag of a parent tag because I am scraping a webpage has multiple classes by the same name and I am just trying to get the one that I need. I have looked in the docs and cant find information or cant understand the information about this.I hope someone can help me out with this alos at the same time helping the community. If this is a duplicate please inform me in the comments and I will close the question. Here is a minimal reproducible example:
import requests
from bs4 import BeautifulSoup
page = requests.get("https://weather.com/en-IE/weather/tenday/l/e98742cdb581b2f4461e4f438badbfb0e16dc9e70ffbf4c8df1b0f7a4394f9f9")
soup = BeautifulSoup(page.content,"lxml")
parent = soup.find("span" class_= "DetailsSummary--extendedData--365A_"("details" , class_ = "Disclosure themeList--25Q0H"))
print(parent)
Hope someone can answer as soon as possible.
Solution
Can use find parent then add .find on to that and put in your prematers
Answered By - GCIreland
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.