Re: [Pyparsing] Check for tabs
Brought to you by:
ptmcg
From: Mario R. O. <nim...@gm...> - 2013-10-29 01:05:58
|
I'm by no means an expert, but a couple of years ago I did finish what I like to call a medium difficulty parser. Yes you can definetly do that with pyparse and regex Dtb/Gby ======= Mario R. Osorio "... Begin with the end in mind ..." http://www.google.com/profiles/nimbiotics On Mon, Oct 28, 2013 at 6:41 PM, Hanchel Cheng <han...@br...>wrote: > Regardless of "all [I] have," I'd like to know if pyparser can check for a > specific number of tabs between alphanumeric strings. If there are not two > tabs between the 2nd and 3rd word, I'd like to error out. Is pyparsing > truly overkill for this task? > > Thanks, > Hanchel > > -----Original Message----- > From: Diez B. Roggisch [mailto:de...@we...] > Sent: Monday, October 28, 2013 1:58 PM > To: Hanchel Cheng > Cc: pyp...@li... > Subject: Re: [Pyparsing] Check for tabs > > > > > I'm new to pyparsing and relatively new to Python as well. I'm really > astounded by the multitude of functionality that pyparsing has. > > My question is pretty basic: > > I have a string 'name\tdate\t\tlocation'. > > What would I do to ensure that between the 'name' and 'date' there is > exactly one tab and between 'date' and 'location' there is exactly two tabs? > > If that's all you have, I would forego pyparsing and use single > string-functions like > > name, date, _, location = line.split("\t") > > plus of course some error-handling. > > Diez > > > > ------------------------------------------------------------------------------ > Android is increasing in popularity, but the open development platform that > developers love is also attractive to malware creators. Download this white > paper to learn more about secure code signing practices that can help keep > Android apps secure. > http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk > _______________________________________________ > Pyparsing-users mailing list > Pyp...@li... > https://lists.sourceforge.net/lists/listinfo/pyparsing-users > |