Parsing a potentially corrupted file

Paul Rubin no.email at nospam.invalid
Wed Dec 14 17:43:53 EST 2016


Paul  Moore <p.f.moore at gmail.com> writes:
> I'm looking for a reasonably "clean" way to parse a log file that
> potentially has incomplete records in it.

Basically trial and error.  Code something reasonable, run your program
til it crashes on a record that it doesn't know what to do with, add
code to deal with that, rinse and repeat.  I've done this kind of thing
multiple times.  You tend to get exponentially further along with each
run/crash/fix iteration til you get most of everything, though there
might still be an occasional hopeless record that you have to just log.


More information about the Python-list mailing list