Message239879
| Author |
rhettinger |
| Recipients |
rhettinger |
| Date |
2015年04月02日.07:01:49 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1427958110.33.0.788273316254.issue23847@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
The xml.dom.minidom package has as a xml.toprettyxml() function that has the problem of altering the whitespace of the text of elements. The ElementTree module needs a prettify option that works better, perhaps something based of Effbot's code at:
http://effbot.org/zone/element-lib.htm#prettyprint
The lxml package also provides an API for this purpose:
print(etree.tostring(root, pretty_print=True)) |
|
History
|
|---|
| Date |
User |
Action |
Args |
| 2015年04月02日 07:01:50 | rhettinger | set | recipients:
+ rhettinger |
| 2015年04月02日 07:01:50 | rhettinger | set | messageid: <1427958110.33.0.788273316254.issue23847@psf.upfronthosting.co.za> |
| 2015年04月02日 07:01:50 | rhettinger | link | issue23847 messages |
| 2015年04月02日 07:01:49 | rhettinger | create |
|