New to web scraping and coding in general. This is probably an easy problem for someone more experienced... maybe not... here it is:
Trying to web scrape a table from wikipedia. I've located the table in the html and added that info in my code. However when I run it I get 'none' returned instead of confirmation the table has been correctly located.
from bs4 import BeautifulSoup
from urllib.request import urlopen
url = 'https://en.wikipedia.org/wiki/List_of_songs_recorded_by_the_Beatles'
html = urlopen(url)
soup = BeautifulSoup(html, 'html.parser')
table = soup.find('table',{'class':'wikitable sortable plainrowheaders jquery-tablesorter'})
print(table)
Return: None
Remove the
jquery-tablesorterfrom the "class" string - this class is added by javascript and beautifulsoup doesn't see it (note: always observe the real HTML document the servers sends you, that's what is beautifulsoup seeing - pressctrl-Uin your browser):Prints: