I have code from this Question: Why is Python’s eval() rejecting this multiline string, and how can I fix it? When I use this code: The result is: I am expecting this: How can I change the code? I tried to change the code, but I was not successful. Answer The code you’ve posted sorts the ast tree body in