开发者

Python Code Introspection and Analysis

开发者 https://www.devze.com 2023-01-02 06:11 出处:网络
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 ge

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消