Python Libcst: Unable to generate code from the node in visitor class
问题 I am searching for a way to get code from the node in the visitor. Example: import libcst code_example = """ from ast import parse threshold = 1 print(threshold) """ class CodeVisitor(libcst.CSTVisitor): def visit_Assign(self, node: libcst.Assign) -> bool: print(node) return True demo = libcst.parse_module(code_example) demo.visit(CodeVisitor()) In the above code I want to get the code(i.e. threshold = 1) of the node . But it seems like libcst doesn't provide that support. I further looked