In the middle of writing
Converting source code to AST
An Abstract Syntax Tree.
A tree structure representing the structure of a program.
TLDR
Use the standard library ʻast` for Python parsing. For reference, Green Tree Snakes --the missing Python AST docs
__My environment __
__ What to do __
pip install astor
import astor
tree = astor.parse_file("hello.py")
#Continued from the above code
source_code = astor.to_source(tree)
Recommended Posts