from bs4 import BeautifulSoup
import requests
url_link = "https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States"
source = requests.get(url_link).text
soup = BeautifulSoup(source, "lxml")
my_table = soup.find("table", class_ = "wikitable sortable plainrowheaders jquery-tablesorter")
from bs4 import BeautifulSoup
import requests
url_link = "https://en.wikipedia.org/wiki/List_of_states_and_territories_of_the_United_States"
source = requests.get(url_link).text
soup = BeautifulSoup(source, "lxml")
my_table = soup.find("table", class_ = "wikitable sortable plainrowheaders")
I was wondering whether anybody knows why the first block of code gives me a none object, but the second block of code returns what I want. Is it something to do with hyphenated class names? Thanks in advance:)!