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> &lt;<a href="mailto:kent37@tds.net">
kent37@tds.net</a>&gt; 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>&gt; Hello,<br>&gt;<br>
&gt; I&#39;m working on a program that need to parse a financial document on the<br>&gt; internet<br>&gt; using BeautifulSoup. Because of the nature of the information, it is all<br>&gt; grouped<br>&gt; as a table. I needed to get 3 types of info and have succeeded quite
<br>&gt; well using<br>&gt; BeautifulSoup, but encountered problems on the third one.<br>&gt;<br>&gt; My question is that is there any easy way to parse an HTML tables column<br>&gt; easily using BeautifulSoup. I copied the table here and I need to
<br>&gt; extract the EPS. The numbers are<br>&gt; every sixth one from the&nbsp;&nbsp;&lt;tr&gt; 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 = &#39;&#39;&#39;&lt;table id=&quot;INCS&quot; style=&quot;width:580px&quot; class=&quot;f10y&quot;
<br>cellspacing=&quot;0&quot;&gt;<br>&lt;snip the rest of your data&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;...: &lt;/table&gt;&#39;&#39;&#39;<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(&#39;tr&#39;):<br>&nbsp;&nbsp;&nbsp;&nbsp;....:&nbsp;&nbsp;&nbsp;&nbsp; print tr.contents[11].string<br>&nbsp;&nbsp;&nbsp;&nbsp;....:<br>&nbsp;&nbsp;&nbsp;&nbsp;....:<br>EPS<br>2.27<br>&nbsp;&nbsp;1.86<br>1.61<br>&nbsp;&nbsp;1.27<br>1.18<br>&nbsp;&nbsp;0.84<br>0.73<br>&nbsp;&nbsp;0.46<br>0.2<br>&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;Sir Winston Churchill