On this page
ast.main
Prev: ast.literal_eval | Up: ast | Next: ast.parse
Rel: ast.Add, ast.alias, ast.And, ast.AnnAssign
Ref: docs.python.org — ast.main
Tags: #public #python3 #stdlib #ast
Import
import ast
from ast import main
Signature & Overview
ast.main(args=None)
ast.main() function.
Usage
import ast
# Entry point for `python3 -m ast script.py`
assert callable(ast.main)
Gotchas
- CLI inspector: Run
python3 -m ast -i 2 file.pyin a terminal to pretty-print any file's AST.
REPL Inspect
from ast import main
help(main)
Linked from
Related notes
- tuts/python3/stdlib_module/ast/literal_eval Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/parse Linked here; links to this page; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/Add Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/alias Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/And Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AnnAssign Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/AST Linked here; shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/ast/arg shared tags: #ast, #stdlib
- tuts/python3/stdlib_module/ast/arguments shared tags: #ast, #stdlib