Python parses XML using elementtree

Source: Internet
Author: User
Tags xml parser

Elementtree (element tree ).

Elementtree is an XML parsing library and has been included in the standard library after python2.5.

Elementtree is like a lightweight Dom with easy-to-use and friendly APIs. In addition to code reusability, it runs fast and consumes less memory. Here we recommend elementtree. If you want to use the XML parser, try elementtree first.

Versions earlier than 2.5 need to install the elementtree package, you can download the corresponding version of the package in the http://effbot.org/downloads/#elementtree, and then use the root command to execute the command has been installed:

Tar zxvf elementtree-1.2.6-20050316.tar.gz

CD elementtree-1.2.6-20050316

Chmod + x *. py

./Setup. py install

[Root @ gd37vm01 elementtree-1.2.6-20050316] #./setup. py install
Running install
Running build
Running build_py
Creating build
Creating build/lib
Creating build/lib/elementtree
Copying elementtree/elementinclude. py-> build/lib/elementtree
Copying elementtree/sgmlopxmltreebuilder. py-> build/lib/elementtree
Copying elementtree/elementtree. py-> build/lib/elementtree
Copying elementtree/elementpath. py-> build/lib/elementtree
Copying elementtree/xmltreebuilder. py-> build/lib/elementtree
Copying elementtree/_ init _. py-> build/lib/elementtree
Copying elementtree/simplexmltreebuilder. py-> build/lib/elementtree
Copying elementtree/tidyhtmltreebuilder. py-> build/lib/elementtree
Copying elementtree/tidytools. py-> build/lib/elementtree
Copying elementtree/simplexmlwriter. py-> build/lib/elementtree
Copying elementtree/htmltreebuilder. py-> build/lib/elementtree
Running install_lib
Copying build/lib/elementtree/elementinclude. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/sgmlopxmltreebuilder. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/elementpath. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/xmltreebuilder. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/_ init _. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/simplexmltreebuilder. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/tidyhtmltreebuilder. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/tidytools. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/simplexmlwriter. py->/usr/lib/python2.4/Site-packages/elementtree
Copying build/lib/elementtree/htmltreebuilder. py->/usr/lib/python2.4/Site-packages/elementtree

Specific use:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.