Regular Expressions: Can't quite figure this problem out
Fredrik Lundh
fredrik at pythonware.com
Wed Sep 26 04:09:46 EDT 2007
Robert Dailey wrote:
> Hmm, ElementTree.tostring() also adds a space between the last character
> of the element name and the />. Not sure why it is doing this.
ET is commonly used to generate (X)HTML fragments, and that space
provides partial HTML compatibility.
since the default serializer never generates CDATA sections, it should
be safe to simply do a text.replace(" />", "/>") on the resulting string.
</F>
More information about the Python-list
mailing list