Skip to content Skip to sidebar Skip to footer

How Can I Crawl Web Data That Not In Tags

' 1.name:jorden> 2.age:28

Solution 1:

You want to find the tag before the text in question (in your case, <div class="metaline">) and then look at the next sibling in the HTML parse tree:

text = soup.find("div", class_='metaline').next_sibling
print(text)
# "# 1.name:jorden> # 2.age:28##  --# "# 

Once you get the raw text, strip it, etc.

Post a Comment for "How Can I Crawl Web Data That Not In Tags"