Python Code Introspection and Analysis
I am trying to write a Python code analyzer, and I am trying to avoid having to parse bare Python text files. I was hoping that once the Python compiler/interpreter parses the code there's a way to get to the object code or parse tree from within a running Python program.
Is there anyway to do this?
Thank yo开发者_C百科u
A combination of ast and tokenize should provide the necessary framework for what you want to do.
You can take a look at Python's abstract syntax trees.
精彩评论