Best Way to extract Numbers from String

Jimbo nilly16 at yahoo.com
Sat Mar 20 04:04:08 CET 2010


Hello

I am trying to grab some numbers from a string containing HTML text.
Can you suggest any good functions that I could use to do this? What
would be the easiest way to extract the following numbers from this
string...

My String has this layout & I have commented what I want to grab:
[CODE] """</th>
				<td class="last">43.200 </td>
				<td class="change indicator" nowrap>0.040 </td>

                                                   <td>43.150 </td> #
I need to grab this number only
				<td>43.200 </td>
                                                   <td>43.130 </td> #
I need to grab this number only
				<td>43.290 </td> 				             <td>43.100 </td> # I need to
grab this number only
				<td>7,450,447 </td>
				<td class="middle"><a
					href="/asx/markets/optionPrices.do?
by=underlyingCode&underlyingCode=BHP&expiryDate=&optionType=">Options</
a></td>
				<td class="middle"><a
					href="/asx/markets/warrantPrices.do?
by=underlyingAsxCode&underlyingCode=BHP">Warrants &amp; Structured
Products</a></td>
				<td class="middle"><a
					href="/asx/markets/cfdPrices.do?
by=underlyingAsxCode&underlyingCode=BHP">CFDs</a></td>
				<td class="middle"><a href="http://hfgapps.hubb.com/asxtools/
Charts.aspx?
TimeFrame=D6&amp;compare=comp_index&amp;indicies=XJO&amp;pma1=20&amp;pma2=20&amp;asxCode=BHP"><img
src="/images/chart.gif" border="0" height="15" width="15"></a>
</td>
				<td><a href="/research/announcements/status_notes.htm#XD">XD</a>
				</td>
				<td><a href="/asx/statistics/announcements.do?
by=asxCode&asxCode=BHP&timeframe=D&period=W">Recent</a>
</td>
			</tr>"""[/CODE]



More information about the Python-list mailing list