开发者

How do I tell pyparsing to discard parts of the parsed string?

I'm writing a parser for some marked-up data,开发者_如何学Go and I'd like to get pyparsing to discard things like start and end tags in the final result, leaving just the data.

Can I do this, or do I just have to name the value appropriately and pull them out manually?


"Suppress" is probably what you want. You can use the Suppress class explicitly, as in dont_care = Suppress(Word(alphas)) or call suppress() on any expression, dont_care = Word(alphas).suppress(). This will suppress the matched tokens from appearing in the parsed output.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜