Best Way to extract Numbers from String

Gabriel Genellina gagsl-py2 at
Sat Mar 20 04:21:44 CET 2010

En Sat, 20 Mar 2010 00:04:08 -0300, Jimbo <nilly16 at> escribió:

> 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

I'd use BeautifulSoup [1] to handle bad formed HTML like that.


Gabriel Genellina

More information about the Python-list mailing list