= 5') In [4]: print(astunparse.dump(tree)) Module(body=[Assign( targets=[Name( id='x', ctx=Store())], value=Num(n=5))]) In [5]: tree.body[0].targets[0].id Out[5]: 'x' In [6]: astunparse.unparse(tree) x = 5 In [7]: tree.body[0].targets[0].id = 'y' In [8]: print(astunparse.unparse(tree)) y = 5