On Tue, 13 Oct 2009 12:35:13 +0530, Rustom Mody wrote: > At http://www.secnetix.de/olli/Python/block_indentation.hawk I find that > the python code > >>>> if foo: > ... if bar: > ... x = 42 > ... else: > ... print foo > ... > > has its indentation structure made explicit as > > <if> <foo> <:> [0] > <INDENT> <if> <bar> <:> [0, 4] > <INDENT> <x> <=> <42> [0, 4, 8] > <DEDENT> <DEDENT> <else> <:> [0] > <INDENT> <print> <foo> [0, 2] > <DEDENT> [0]
Have you looked at the tokenize module? http://docs.python.org/library/tokenize.html -- Steven -- http://mail.python.org/mailman/listinfo/python-list