'Is there any way to outout blank as in lxml or other python xml lib?
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>
Solution 1:[1]
I solved this problem by replace blank to '\xa0' (160 is
ascii code)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Demon King |