
Add options: method=‘c14n2’, strip_text=True When you serialize the output. ( pretty_print should also be the default False )
print(etree.tostring(etree.fromstring(ss),method='c14n2', strip_text=True)) b'<wpt lat="46.98520" lon="6.8831"><name>blah</name></wpt>'
On Aug 8, 2022, at 3:32 PM, Gilles <codecomplete@free.fr> wrote:
Hello,
Before I resort to a regex, I figured I should ask here.
To find and remove possible duplicates, I need to turn each block into a single line:
FROM
<wpt lat="46.98520" lon="6.8831"> <name>blah</name> </wpt>
TO
<wpt lat="46.98520" lon="6.8831"><name>blah</name></wpt>
Do you know of a way to do this in lxml?
Thank you.
_______________________________________________ lxml - The Python XML Toolkit mailing list -- lxml@python.org To unsubscribe send an email to lxml-leave@python.org https://mail.python.org/mailman3/lists/lxml.python.org/ Member address: sdm7g@virginia.edu