[http://effbot.org/zone/element-index.htm Elements and Element Trees] (effbot.org) 的简要使用
ElementTree
cElementTree
2005年发布 cElementTree C内核的 ElementTree
effbot.org proudly presents the cElementTree library, a fast and very efficient implementation of the ElementTree API, for Python 2.1 and later. On typical documents, it's 15-20 times faster than the Python version of ElementTree, and uses 2-5 times less memory. The 0.9.2 release is 10-20% faster than 0.8 on my benchmarks, and uses 5-15% less memory. Here are some benchmark results, using a number of popular XML tool- kits to parse a 3405k source file on my development machine: library memory time ------------------------------------------------------------ minidom (python 2.1) 80000k 6.5s minidom (python 2.4) 53000k 1.4s ElementTree 1.3 14500k 1.1s cElementTree 0.8 5700k 0.058s cElementTree 0.9 4900k 0.047s ------------------------------------------------------------ readlines (read as utf-8) 8850k 0.093s readlines (read as ascii) 5050k 0.032s ------------------------------------------------------------ For more information on this library, including download instructions, comparisions to other popular XML toolkits, and more, see: