A couple years ago I started a series of articles on XML parsing. I covered lxml’s etree and Python builtin minidom XML parsing library. For whatever reason I didn’t notice lxml’s objectify sub-package, but I saw it recently and decided to check it out. In my mind, the objectify module seems to be even more “Pythonic” than etree is. Let’s take some time and go over my old XML examples using objectify and see how it’s different!
Let’s Get This Party Started!
If you haven’t already, go out and download lxml or you won’t be able to follow along very well. Once you have it, we can continue. We’ll be using the following piece of XML for our parsing pleasure:
10.Bring pizza home
15.Check MS Office website for updates
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/301743/viewspace-732427/，如需转载，请注明出处，否则将追究法律责任。