How to find all tags and strings in a document using find_next()?

0 votes

I am trying to find all the tags and string in a document after a particular element. I am using find_next() for this. 

name.find_next("p")

But the problem is that it is finding only the first element. How to find all elements?

May 14, 2019 in Python by Kumar
69 views

1 answer to this question.

0 votes

You can use the find_all_next() to do this. Try this:

name.find_all_next(string=True)

It should work.

answered May 14, 2019 by Robin

Related Questions In Python

0 votes
1 answer
0 votes
1 answer

How can I write code to find a palindrome in python without using string functions?

In Logic 1, try if i<int(length/2): instead of if i<int((length/2+1)): In ...READ MORE

answered Jan 16, 2019 in Python by charlie_brown
• 7,740 points
4,706 views
–1 vote
2 answers

How to find the size of a string in Python?

following way to find length of string  x ...READ MORE

answered Mar 29, 2019 in Python by rajesh
• 1,230 points
135 views
0 votes
1 answer
0 votes
1 answer

How to parse html file to BeautifulSoup?

Hey. Refer to the following code: driver.get("link") html = ...READ MORE

answered Apr 2, 2019 in Python by Kirti
94 views
0 votes
1 answer
0 votes
3 answers
0 votes
1 answer

how to find files and skip directories in os.listdir

You need to filter out directories; os.listdir() ...READ MORE

answered Mar 6, 2019 in Python by SDeb
• 13,230 points
534 views