So I wrote some code to extract only what's within the <p>
tags of some HTML code. Here is my code
soup = BeautifulSoup(my_string, 'html')
no_tags=' '.join(el.string for el in soup.find_all('p', text=True))
It works how I want it to for most of the examples it is run on, but I have noticed that in examples such as
<p>hello, how are you <code>other code</code> my name is joe</p>
it returns nothing. I suppose this is because there are other tags within the <p>
tags. So just to be clear, what I would want it to return is
hello, how are you my name is joe
can someone help me out regarding how to deal with such examples?