Why Can't I drill down to the tag I want using BeautifoulSoup
I want to extract the PRODUCT CODE from CME(Chicago Mercantile Exchange).
Q1: I thought I can extract it from table -> tr. But the code only stops at the TRADING HOURS' text. Please guide me how I can go deeper to get the PRODUCT CODE with certain texts.
If it successes, we should be able to see:
CME Globex: ZC
CME ClearPort: C
Clearing: C
TAS: ZCT
Q2: Then somehow, I would just need the word ZC then put in my csv file.
from urllib.request import urlopen as uReq
from urllib.request import Request
from bs4 import BeautifulSoup as soup
AccessCME=Request("http://ift.tt/2u0athM
oilseed/corn_contract_specifications.html",headers={"User-Agent":"Mozilla/5.0"})
CMEPage=uReq(AccessCME).read()
page_soup=soup(CMEPage,"html.parser")
table=page_soup.find("table")
rows=table.find_all("tr")
print(rows)
If it's not clear, let me know then I will clarify more.
Aucun commentaire:
Enregistrer un commentaire