I am using BeautifulSoup to parse a webpage. Now I would like to read the Index value 31811.75
from the span:
<span>Underlying Index: <b style="font-size:1.2em;">BANKNIFTY 31811.75</b> </span>
Unfortunately the span lacks any other identifies such as class
. I followed the solutions mentioned on a similar question, but I don't seem to get the whole text:
>>> print(soup.body(text=re.compile('Underlying')))
['Underlying Index: ']
I would like the used the keyword Underlying
to extract the text present in the span. How can I do this?