On Tue, Jan 13, 2015 at 6:48 AM, Ian <hobso...@gmail.com> wrote: > My recommendation would be to write a recursive decent parser for your > files. > > That way will be easier to write, much easier to modify and almost certainly > faster that a RE solution - and it can easily give you all the information > in the file thus future proofing it.
Generally, even a recursive descent parser will be overkill. It's pretty easy to do simple string manipulation to get the info you want; maybe that means restricting the syntax some, but for a personal-use script, that's usually no big cost. The example I gave requires that the indentation be correct, and on this mailing list, I think people agree that that's not a deal-breaker :) ChrisA -- https://mail.python.org/mailman/listinfo/python-list