lxml empty versus self closed tag

Robin Becker robin at reportlab.com
Wed Mar 2 10:32:34 EST 2022


I'm using lxml.etree.XMLParser and would like to distinguish

<tag></tag>

from

<tag/>

I seem to have e.getchildren()==[] and e.text==None for both cases. Is there a way to get the first to have e.text==''
--
Robin Becker


More information about the Python-list mailing list