Hi,<br><br>Wow, thats much more elegant than the idea I thought of. <br><br>Thank you very much Kent!<br><br>Marshall<br><br><div><span class="gmail_quote">On 1/3/07, <b class="gmail_sendername">Kent Johnson</b> <<a href="mailto:kent37@tds.net">
kent37@tds.net</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Shuai Jiang (Runiteking1) wrote:<br>> Hello,<br>><br>
> I'm working on a program that need to parse a financial document on the<br>> internet<br>> using BeautifulSoup. Because of the nature of the information, it is all<br>> grouped<br>> as a table. I needed to get 3 types of info and have succeeded quite
<br>> well using<br>> BeautifulSoup, but encountered problems on the third one.<br>><br>> My question is that is there any easy way to parse an HTML tables column<br>> easily using BeautifulSoup. I copied the table here and I need to
<br>> extract the EPS. The numbers are<br>> every sixth one from the <tr> tag ex 2.27, 1.86, 1.61...<br><br>Here is one way, found with a little experimenting at the command prompt:<br><br>In [1]: data = '''<table id="INCS" style="width:580px" class="f10y"
<br>cellspacing="0"><br><snip the rest of your data><br> ...: </table>'''<br>In [3]: from BeautifulSoup import BeautifulSoup as BS<br><br>In [4]: soup=BS(data)<br><br>In [11]: for tr in
soup.table.findAll('tr'):<br> ....: print tr.contents[11].string<br> ....:<br> ....:<br>EPS<br>2.27<br> 1.86<br>1.61<br> 1.27<br>1.18<br> 0.84<br>0.73<br> 0.46<br>0.2<br> 0.0<br><br>Kent<br><br><br>
</blockquote></div><br><br clear="all"><br>-- <br>I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals.<br> Sir Winston Churchill