-
-
Save matwey/1cb353358d3685c9b5b9f5c35d5d8fbb to your computer and use it in GitHub Desktop.
Erlang/OTP notes.xml parser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import xml.etree.ElementTree as ET | |
| import textwrap | |
| w = textwrap.TextWrapper(initial_indent=' * ', subsequent_indent=' ', width=62) | |
| root = ET.parse('notes.xml') | |
| for x in root.findall('./section[title]'): | |
| print(x.find("title").text) | |
| z = x.findall("./section[title='Fixed Bugs and Malfunctions']/list/item/p[1]") | |
| for y in z: | |
| t="".join(y.itertext()) | |
| print("\n".join(w.wrap(" ".join(t.split())))) | |
| z = x.findall("./section[title='Improvements and New Features']/list/item/p[1]") | |
| for y in z: | |
| t="".join(y.itertext()) | |
| print("\n".join(w.wrap(" ".join(t.split())))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment