What are the Difference between cElementtree and ElementTree?

后端 未结 5 1783
感动是毒
感动是毒 2021-01-01 14:00

I know a little of dom, and would like to learn about ElementTree. Python 2.6 has a somewhat older implementation of ElementTree, but still usable. However, it looks like it

5条回答
  •  太阳男子
    2021-01-01 14:03

    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).

提交回复
热议问题