-1

I'm trying to parse the table given at this location: "http://en.wikipedia.org/wiki/Quartz" The property table is identified as the class = infobox ww_ib ww_ib_1. I am expecting to obtain the values given in the table such as: 'Category, Oxide, Chemical formula etc..." However, the table returns a None type. Could someone please help me?

from bs4 import BeautifulSoup
import requests
wiki = "http://en.wikipedia.org/wiki/Quartz"
header = {'User-Agent': 'Mozilla/5.0'}
req = requests.get(wiki,headers=header)
soup = BeautifulSoup(req.content)
table = soup.find("table", { "class" : "infobox ww_ib ww_ib_1" })
print (table)

Please do let me know if you know of better ways to scrape wikipedia!

vineeth venugopal
  • 1,064
  • 1
  • 9
  • 17

1 Answers1

0

I was able to figure out what the problem was. The class of the table is just 'infobox' and not 'infobox ww_ib ww_ib_1"

vineeth venugopal
  • 1,064
  • 1
  • 9
  • 17