Convert an AST back to Python source code.
The AST node to unparse
The indentation string (default: 4 spaces)
The generated Python source code
import { parseModule, toSource } from "py-ast";const tree = parseModule("x=1");console.log(toSource(tree)); // "x = 1" Copy
import { parseModule, toSource } from "py-ast";const tree = parseModule("x=1");console.log(toSource(tree)); // "x = 1"
Convert an AST back to Python source code.