Skip to content

Instantly share code, notes, and snippets.

@matwey
Created September 10, 2018 18:06
Show Gist options
  • Select an option

  • Save matwey/1cb353358d3685c9b5b9f5c35d5d8fbb to your computer and use it in GitHub Desktop.

Select an option

Save matwey/1cb353358d3685c9b5b9f5c35d5d8fbb to your computer and use it in GitHub Desktop.
Erlang/OTP notes.xml parser
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