Skip to content Skip to sidebar Skip to footer

How To Get Next Div When I Use Beautifulsoup .findall?

I work with BeautifulSoup in python2.7 I have code like this: html = '
\
\
\
one
\
\

Solution 1:

When you get to the one div, get the following div sibling and then all div elements inside:

one = currency[1].div.div
for elm in one.find_next_sibling("div").find_all("div"):
    print(elm.get_text())

Prints:

two
three
four

Post a Comment for "How To Get Next Div When I Use Beautifulsoup .findall?"