I am trying to get a block of lines between 2 known lines using pyparsing. For example:
ABC
....
DEF
My python code:
end = Literal("\n").suppress()
firstLine = Literal("ABC") + SkipTo(end)
secondLine = Literal("DEF") + SkipTo(end)
line = SkipTo(end)
test = firstLine + OneOrMore(line) + secondLine
test.searchString(myText)
–> but it doesn’t work. Python just hangs.
Can anybody show me how to do it?
Thanks,
I finally found answer to my question.
That works for me.