What are the Difference between cElementtree and ElementTree?

But now they are the same thing as of Python 3.3, in github source code cElementTree

# cElementTree.py

from xml.etree.ElementTree import *

it is just for backward compatibility


It is the same library (same API, same features) but ElementTree is implemented in Python and cElementTree is implemented in C.

If you can, use the C implementation because it is optimized for fast parsing and low memory use, and is 15-20 times faster than the Python implementation.

Use the Python version if you are in a limited environment (C library loading not allowed).

Tags:

Python

Xml