sample code for parsing html file to get contents of td fields
Bill Mill
bill.mill at gmail.com
Thu Aug 4 15:56:47 EDT 2005
On 4 Aug 2005 11:54:38 -0700, yaffa <yxxxxlxxxxx at gmail.com> wrote:
> does anyone have sample code for parsting an html file to get contents
> of a td field to write to a mysql db? even if you have everything but
> the mysql db part ill take it.
>
Do you want something like this?
In [1]: x = "something <td><b>something</b> else</td> and\nanother thing <td>in
a td</td> and again else"
In [2]: import re
In [3]: r = re.compile('<td>(.*?)</td>', re.S)
In [4]: r.findall(x)
Out[4]: ['<b>something</b> else', 'in a td']
If not, you'll have to explain more clearly what you want.
Peace
Bill Mill
bill.mill at gmail.com
More information about the Python-list
mailing list