parsing a dbIII file
steve at holdenweb.com
Tue Aug 7 09:21:37 CEST 2007
korovev76 at gmail.com wrote:
> Hello everybody, I'm new to python (...I work with cobol...)
> I have to parse a file (that is a dbIII file) whose stucture look like
> |string|, |string|, |string that may contain commas inside|, 1, 2, 3, |
> other string|
> Is there anything in python that parses this stuff?
> thanks a lot
That's not a standard dBaseIII data file though, correct? It looks more
like something that was produced *from* a dBaseIII file.
If the format is similar to Excel's CSV format then the csv module from
Python's standard library may well be what you want. Otherwise there are
parsers at all levels - one called PyParsing is quite popular, and I am
sure other readers will have their own suggestions.
I am not sure whether the pipe bars actually appear in your data file,
so it is difficult to know quite exactly what to suggest, but I would
play with the file in an interactive interpreter session first to see
whether csv can do the job.
Good luck with your escape from COBOL!
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------
More information about the Python-list