Re: [Pyparsing] parse challange, at least for me:)
Brought to you by:
ptmcg
From: Werner <wer...@gm...> - 2014-05-24 12:43:32
|
Hi, Made a bit of progress, following works for my test string, but doesn't yet for when I parse files. tagStart = pp.Literal("# Tags:").setDebug() otherStuff = pp.lineStart + pp.restOfLine def aTagLineAction(s, l, t): return 'test' aTagLine = tagStart + pp.restOfLine aTagLine.setParseAction(aTagLineAction) allLines = pp.OneOrMore(otherStuff | aTagLine) result = allLines.parseString(test) print(result) Werner |