Pyparsing - Dealing with a Blank Value

Steve stever at cruzio.com
Fri Jan 26 12:30:02 EST 2007


Hi Paul!

Thanks for your suggestions on the default value (I didn't know you
could do that!!) and the use of the makeHTMLtags module!

Steve

On Jan 25, 8:07 pm, "Paul McGuire" <p... at austin.rr.com> wrote:
> 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.
>
> <snip>
>
> > Any assistance would be greatly appreciated!
>
> > SteveJust define a default value to be returned for MultiItem if the
> Optional expression is not found:
>
>     MultiItem = Optional(OneOrMore(dataItem),default="")
> 
> Define default to be whatever string you choose.
> 
> -- Paul




More information about the Python-list mailing list