Parsing BeautifulSoup Html Tag
I need to parse an HTML file using BeautifulSoup. The HTML looks like that:
Solution 1:
You will have to tidy the output but this will get what you need:
from bs4 import BeautifulSoup
soup = BeautifulSoup(html)
res= (["\n".join(s.strip() for s in x.text.splitlines()).replace(";","") for x in soup.find_all("div", {"class":"hom"})])
print("\n".join(res))
intransitive verb
1 [person] (in bed) se retourner
2 [car] se retourner, faire un tonneau
3 (= switch TV channels) changer de chaƮne
▶ transitive verb
1
a [+ object] retourner
b [+ page] tourner
c [+ tape] changer de face
2 (= hand over) remettre
Post a Comment for "Parsing BeautifulSoup Html Tag"