Parser needed.

Michael Torrie torriem at gmail.com
Mon Jun 1 21:12:12 EDT 2015


On 06/01/2015 06:29 PM, Skybuck Flying wrote:
> The parser should be able to parse a textfile of somewhere between 20.000 
> lines to 50.000 lines in about 1 to 2 seconds.
> 
> My environment is SikuliX 1.1

I don't have any inclination to examine your input files, but you could
certainly mock up a parser fairly quickly with the fantastic pyparsing
module (you'll have to install it from your distro's package manager, or
through pip.

Once you have figure out how to parse the data you can fill in your data
structures as you go along.  Pyparsing has pretty good docs; just google
for it.  Usually first I get pyparsing working on my input file, then I
add code to each of the steps along the way to actually do something
with the data that has been parsed.

You could parse it manually using regular expressions if the data is
fairly structured and regular.





More information about the Python-list mailing list