py-py’s blog

何か書くよ

xml

Pythonxmlを扱うスニペットを挙げて最後に何でtagを使うんだろう と思っていたが、cpythonのコードを見てみたら書いてあった。

Element is a flexible container object designed to store hierarchical data
 structures in memory. It can be described as a cross between a list and a
 dictionary.  Each Element has a number of properties associated with it:
    'tag' - a string containing the element's name.
    'attributes' - a Python dictionary storing the element's attributes.
    'text' - a string containing the element's text content.
    'tail' - an optional string containing text after the element's end tag.
    And a number of child elements stored in a Python sequence.