Aug-03-2021, 11:51 AM
Hey all,
I am practicing webscraping and I've come across a scenario where I'm a little stuck.
First, here's a snapshot of the code (which works up to this point)
).
Would anyone be able to enlighten me on how to navigate through the current results to then go on to extract the 1 between the span tags please?
Thanks a lot.
I am practicing webscraping and I've come across a scenario where I'm a little stuck.
First, here's a snapshot of the code (which works up to this point)
from bs4 import BeautifulSoup import requests import pandas as pd url = ('mytesturl') page = requests.get(url) soup = BeautifulSoup(page.text, 'html.parser') voteup = (soup.find('span', {'class': 'nvb voteup'})) print(voteup)This gives me the following result:
Output:<span class="nvb voteup"><i class="fa fa-plus"></i><span>1</span></span>
So what I'm trying to do, is be able to navigate through this result and extract the "1" towards the end between the 'span' tags. I've tried looking through some of the BeautifulSoup documentation and also tried searching online (although not sure what to properly search for in Google and maybe missed it in the BS documentation too 
Would anyone be able to enlighten me on how to navigate through the current results to then go on to extract the 1 between the span tags please?
Thanks a lot.