问题描述
如何让 ElementTree.toString 方法从节点的文本属性输出
?
import xml.etree.cElementTree as ET
node = ET.Element("node")
node.text = "hello there"
print(ET.tostring(node,encoding = 'utf8',method = "xml",xml_declaration = False).decode('utf8'))
输出:
<node>hello&nbsp;there</node>
但我希望它识别
实体和输出:
<node>hello there</node>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)