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
301 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,780 points
7,679 views
0 votes
1 answer

how can i extact all the links from a website using python and save it in a csv file ?

Hi, @Shubham, Web scraping is the technique to ...READ MORE

answered Jun 16 in Python by Gitika
• 36,530 points
179 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
606 views
0 votes
1 answer
0 votes
4 answers

What is a Tuple in Python and how to use it?

Tuples  are a  Unchanging sequence of values, ...READ MORE

answered Jun 21 in Python by sahil
• 540 points
434 views
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,250 points
2,218 views