Answers for "how to read comment before the root element of xml python"

0

how to read comment before the root element of xml python

>>> from lxml import etree
>>> tree = etree.parse('filename.xml')
>>> root = tree.getroot()
>>> print root.getprevious()
<!--Comment 1-->
Posted by: Guest on August-08-2021

Python Answers by Framework

Browse Popular Code Answers by Language