kent37 at tds.net
Fri Mar 21 13:01:23 CET 2008
Eric Walker wrote:
> I have been reading about python grammers for processing text files. Does anyone have any simple examples?
Do you mean parsers written in Python for processing text files? A
grammar is usually an abstract specification of a format, not something
that will actually process the format.
There are many add-on packages for writing parsers in Python. A good
list is here:
IMO pyparsing is one of the easiest to use. It comes with many examples:
One of the pyparsing examples parses grammar descriptions in Extended
Backus-Naur Form (EBNF) and produces a pyparsing parser for the grammar:
David Mertz' book Text Processing in Python has many examples:
More information about the Tutor