Re: [Pyparsing] Using grammar as a condition for loop
Brought to you by:
ptmcg
From: Mario R. O. <nim...@gm...> - 2013-11-06 03:32:34
|
> Can pyparsing do this? Saying yes is pretty much an understatement, but thats what you want to hear I guess, so yes it can. Dtb/Gby ======= Mario R. Osorio "... Begin with the end in mind ..." http://www.google.com/profiles/nimbiotics On Tue, Nov 5, 2013 at 8:14 PM, Hanchel Cheng <han...@br...> wrote: > Hello! > > I have a text file in a structure like this: > ######start####### > [line1 matching grammar] > #[text] > #[text] > [text] > > [line2 matching grammar] > #[text] > [etc.] > #######end####### > There can be N amounts of lines with or without the # under each indent > with a line that matches the grammar. > > I'm checking for the grammar, then I would like to check all the lines > until the next line that follows the grammar. > > Something like... > for line in text_file: > if not(line matches grammar): > do something > > Can pyparsing do this? If not, any suggestions? I can give more info if > necessary. > > I really appreciate the help! > > Kind regards, > Hanchel > > ------------------------------------------------------------------------------ > November Webinars for C, C++, Fortran Developers > Accelerate application performance with scalable programming models. > Explore > techniques for threading, error checking, porting, and tuning. Get the most > from the latest Intel processors and coprocessors. See abstracts and > register > http://pubads.g.doubleclick.net/gampad/clk?id=60136231&iu=/4140/ostg.clktrk > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users > |