Join the DZone community and get the full member experience.Join For Free
ElementTree is a library that make XML processing in python much, much easier. It will be included in Python 2.5 too. Here's how to use it to read/extract XML
from elementtree.ElementTree import parse tree = parse(filename) doc = tree.getroot() # Element type (name): print doc.tag # Element text: print doc.text # get the child of element type book book = doc.find('book') # element's attribute book.keys() book.items() book.get('COLOR') # first matching element's text booktext = doc.findtext('book')Read more here and here.