Is there an equivalent of Beautiful Soup's tag.renderContents() method in lxml?
I've tried using element.text, but that doesn't render child tags, as well as ''.join(etree.tostring(child) for child in element), but that doesn't render child text. The closest I've been able to find is etree.tostring(element), but that renders the opening and closing tags of element, which I do not want.
Is there another method I'm overlooking (or an alternative approach to accomplish this)?
No comments:
Post a Comment