Skip to content

Instantly share code, notes, and snippets.

@waldofe
Created September 12, 2012 00:25
Show Gist options
  • Save waldofe/3703256 to your computer and use it in GitHub Desktop.
Save waldofe/3703256 to your computer and use it in GitHub Desktop.
Xmlns simple parser.
from elementtree import ElementTree as ET
class XmlnsParser(object):
def __init__(self, path):
self.path = path
def tags_and_texts(self):
self.tags_n_text = {}
file = open(self.path, 'r')
elements = ET.parse(file)
for elem in elements.getiterator():
self.tags_n_text.update({elem.tag: elem.text})
return self.tags_n_text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment