Pyparsing - Dealing with a Blank Value

Paul McGuire ptmcg at austin.rr.com
Thu Jan 25 23:10:11 EST 2007


On Jan 25, 7:13 pm, "Steve" <ste... at cruzio.com> wrote:
> Hi All,
>
> I've picked up thePyParsingmodule and am trying to figure out how to
> do a simple parsing of some HTML source code.  My specific problem is
> dealing with an <TD></TD> element that is blank.
>

I'd also suggest use the makeHTMLTags helper module for the TR and TD
tags:

trStart,trEnd = makeHTMLTags("TR")
tdStart,tdEnd = makeHTMLTags("TD")

makeHTMLTags includes a much more robust definition than just
Literal("<tag>"), including recognition of attributes and tolerance of
upper/lower case.

-- Paul




More information about the Python-list mailing list