How do I pretty print an XML tree that contains whitespace?
Asked by
scoder
Albert Brandl wrote:
If I append a subtree to an element,
>>> elem1 = fromstring("""
... <a>
... <b/>
... <c/>
... </a>""")
>>> elem2 = Element("e")
>>> elem2.append(elem1)
pretty-printing does not what I'd expect:
>>> print tostring(elem2, pretty_print = True)
<e>
<a>
<b/>
<c/>
</a>
</e>
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- lxml Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- scoder
- Solved:
- Last query:
- Last reply:
To post a message you must log in.