Untitled

Run Settings
LanguagePython
Language Version
Run Command
import ast s = """ # 1+1<3 print("1 + 1 < 3", 1+1<3) print(1+1<<3) """ print("before") print(s) print("after") tree = ast.parse(s) print(ast.dump(tree, indent=4)) tree.body[0].value.args[1].ops[0] = ast.Gt() print(ast.unparse(tree)) print("visit" *5) tree = ast.parse(s) class RewriteOp(ast.NodeTransformer): def visit_Lt(self, node): return ast.Gt() node = RewriteOp().visit(tree) print(ast.unparse(node))
Editor Settings
Theme
Key bindings
Full width
Lines