[Python] How to get string dump of lxml Element

Discussão em 'Python' iniciado por Stack, Setembro 2, 2025.

  1. Stack

    Stack Membro Participativo

    I have an lxml Element object:

    >>> from lxml import etree
    >>> xml_str = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<state type=\"before_battle\">\n</state>"
    >>> etree.fromstring(xml_str.encode('utf-8'))
    <Element state at 0x7fd04b957e48>


    How to get the string dump of Element?

    Continue reading...

Compartilhe esta Página