Skip to content

Instantly share code, notes, and snippets.

@netdesign
Created September 24, 2011 19:33
Show Gist options
  • Select an option

  • Save netdesign/1239747 to your computer and use it in GitHub Desktop.

Select an option

Save netdesign/1239747 to your computer and use it in GitHub Desktop.
working XML parser
import lxml.etree as tr
context = tr.iterparse('content.rdf.u8', events=('end',), tag='{http://dmoz.org/rdf/}ExternalPage')
for event, elem in context:
print('%s\n' % elem.text.encode('utf-8'))
elem.clear()
while elem.getprevious() is not None:
del elem.getparent()[0]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment