>>> from lxml import etree >>> tree = etree.parse('filename.xml') >>> root = tree.getroot() >>> print root.getprevious() <!--Comment 1-->