my code is:
>>> from lxml.html import tostring, HtmlElement
>>> a = HtmlElement()
>>> a.tag = "div"
>>> a.text = " "
>>> tostring(a)
b'<div> </div>'
Is there any way to output like in lxml or other python xml library?
<div> </div>
CodePudding user response:
I solved this problem by replace blank to '\xa0' (160 is
ascii code)