View Single Post
Old May 23rd, 2006, 11:02 AM   #122
zem52887
Hobbyist Programmer
 
Join Date: May 2006
Posts: 127
Rep Power: 3 zem52887 is on a distinguished road
Indeed, I thought that I would have to also get the end tag but apparently not. BeautifulSoup is incredible. Wow, so it seems the only difficult one will be the Financial Highlights because they're not on every company. So I've been reading up on if statements so I think one will be necessary for that piece of data, no?

Also one more quickie regarding regex, since "Company Profile" appears more than once, but is constant, I need to format the code such that it fetches me the table surrounding the 3rd "Company Profile" expression, would I format it as follows:
profile = soup.firstText(re.compile("Company Profile"))
companyprofile = profile.findParent("table")[2]
print companyprofile

on second look, I'm trying to get the 3rd "Company Profile" but the second table that follows it, so is this where sibling commands come in?

hm, is this where I'm encountering a problem:
<table
cellpadding=0
cellspacing=0
width=100%>

do I need to give that to BeautifulSoup?
zem52887 is offline   Reply With Quote