View Single Post
Old May 23rd, 2006, 11:20 AM   #124
zem52887
Hobbyist Programmer
 
Join Date: May 2006
Posts: 127
Rep Power: 3 zem52887 is on a distinguished road
soup = BeautifulSoup(html)
profile = soup.fetchText(re.compile("Company Profile"))[2]
companyprofile = profile.findNext("table")
jackpot... I think I'm getting the hang of this.

on to Financial Highlights, this one seems like it's going to be a bit more complex than the other types of data grabbing. Since some companies have financial data posted and others don't, it seems an if-statement is necessary (to me at least) however, the examples I've seen are all like the following:
>>> x = int(raw_input("Please enter an integer: "))
    >>> if x < 0:
    ...      x = 0
    ...      print 'Negative changed to zero'
    ... elif x == 0:
    ...      print 'Zero'
    ... elif x == 1:
    ...      print 'Single'
    ... else:
    ...      print 'More'

since we're dealing with text and not a numerical value, I obviously can't just put:
if Financial Highlights "exist" 
then...
hah, any helpful hints? or am I underestimating BeautifulSoup and if there's no financial highlights will it just skip over it? I assume I have to address it in some way/shape/form.

Last edited by zem52887; May 23rd, 2006 at 11:38 AM.
zem52887 is offline   Reply With Quote