[Tutor] XML data reading [slightly off topic/silly]

Eric Walstad eric at ericwalstad.com
Fri Dec 21 00:04:13 CET 2007

Lockhart, Luke wrote:
> ...now I'm a
> Linux man and trying to realize my overly ambitious programming dreams 
> with Python
Welcome to the real world, Neo.  I'm not saying that you'll be able to 
work with XML via DOM or SAX in Python.  I'm saying that when you are 
ready, you won't have to.  :)
(with apologies to the Wachowski brothers)

 > But I just can't figure out the various
 > libraries that Python uses to read XML, and my friend's code doesn't
 > help much.
I think Google will help with many examples.  Also have a look at the 
Python Cookbook:
for examples.

/me climbs onto soap box (no pun intended)
I think this might be a little off topic but my advice as you learn 
Python, considering you are parsing data and might have OOP experience, 
is to consider that there is value in simple code.  Try to keep an open 
mind and try not to use too many dots, especially if you have control 
over both ends of your data transfer.

Here's what I think is a nice example of roughly 17 lines of python code 
that elegantly parse and process a 5M record file with an impressive 
speed gain, too:

Welcome, have fun and do post to the list when you have specific questions!


More information about the Tutor mailing list