I generated a long and ugly XML string with Python and I need to filter it through pretty printer to look nicer.
I found this post for python pretty printers, but I have to write the XML string to a file to be read back to use the tools, which I want to avoid if possible.
What python pretty tools are available that work on strings?
Here’s how to parse from a text string to the lxml structured data type.
Python 2:
Python 3:
Outputs: