type(ikePanProfiles)
<class 'xml.etree.ElementTree.Element'>
etree.tostring(ikePanProfiles)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "src/lxml/etree.pyx", line 3367, in lxml.etree.tostring
(src/lxml/etree.c:82622)
TypeError: Type 'Element' cannot be serialized.
我正在访问一个API,它以对象类型“xml.etree.ElementTree.Element”进行实物响应所以我不确定如何隐藏这个tostring?
你的元素是xml
库中的一个对象,你正在尝试使用lxml
对其进行字符串化。要么更改代码,以便元素是lxml
库中的对象,要么使用xml.etree.ElementTree.tostring
对其进行字符串化。