[Tutor] Python XML for newbie

Alan Gauld alan.gauld at btinternet.com
Mon Jul 2 01:10:27 CEST 2012


On 01/07/12 21:49, Sean Carolan wrote:
> ... Is there a *simple* way to import an XML
> file into a dictionary, list, or other usable data structure?

The simplest way using the standard library tools is (IMHO)
elementtree. minidom is a complex beast by comparison,
especially if you are not intimately familiar with
your XML structure.

However hthere are some other add-in packages that are
allegedly much easier still.

But I'd start with the etree tutorial (of which
there are many variations on the web):

The original:
http://effbot.org/zone/element-index.htm

My preference:
http://infohost.nmt.edu/tcc/help/pubs/pylxml/web/index.html

You may not need anything else...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/





More information about the Tutor mailing list