I have tried to find a table with class “data” in a web page with this code.
import urllib2
from BeautifulSoup import BeautifulSoup
soup = BeautifulSoup(urllib2.urlopen('http://www.cbssports.com/nba/draft/mock-draft').read())
rows = soup.findAll("table.data")
print rows
However, I am getting none for rows even though I am sure that a table with class “data” exists on that page. What is the proper way to find an element with class “data” on a web page with BeautifulSoup?
If you want to pick up the rows, you’ll need the following
Then you can also iterate through the columns: