[Tutor] MemoryError
Jeff Shannon
jeff at ccvcorp.com
Thu Dec 9 20:53:46 CET 2004
Liam Clarke wrote:
> So, I'm going to throw caution to the wind, and try an re approach. It
> can't be any more unwieldy and ugly than what I've got going at the
> moment.
If you're going to try a new approach, I'd strongly suggest using a
proper html/xml parser instead of re's. You'll almost certainly have
an easier time using a tool that's designed for your specific problem
domain than you will trying to force a more general tool to work.
Since you're specifically trying to find (and replace) certain html
tags and attributes, and that's exactly what html parsers *do*, well,
the conclusions seems obvious (to me at least). ;)
There are lots of html parsing tools available in Python (though I've
never needed one myself). I've heard lots of good things about
BeautifulSoup...
Jeff Shannon
Technician/Programmer
Credit International
More information about the Tutor
mailing list