On Oct 4, 7:50 am, Tim Chase <[EMAIL PROTECTED]> wrote: > Use a parsing lib. I've tinkered a bit with PyParsing[1] which > is fairly easy to pick up, but powerful enough that you're not > banging your head against limitations. There are a number of > other parsing libraries[2] with various domain-specific features > and audiences, but I'd go browsing through them only if PyParsing > doesn't fill the bill. > > As you don't detail what you want to do with the content or how > pathological the input can be, but you might be able to get away > with just skimming through the input and counting open-parens and > close-parens, stopping when they've been balanced, skipping lines > with comments.
thanks Tim. following you and Dan's advice i visited http://python.fyxm.net/topics/parsing.html and i picked up pyparsing after brief reading of descriptions for couple of packages. now that you recommended it, seems that i made a good choice. btw, the content found will be copied to a new text file. -- http://mail.python.org/mailman/listinfo/python-list