replacement of rexec?

Paul Clinch pclinch at internet-glue.co.uk
Thu Oct 23 14:33:38 EDT 2003


You could use the new compiler module to parse and inspect the result like this:

import compiler as cplr
mod = cplr.parseFile("filetoload")
for node in mod.node.nodes:
    if 'Function' in str(node):
        break

etc..
There are probably more accurate ways of determining that the file is what 
you expect.

Otherwise you are back to manually parsing the file as text.

Hope this helps, Paul Clinch




More information about the Python-list mailing list