最佳答案
每当我调用 ElementTree.tostring(e)
时,都会收到以下错误消息:
AttributeError: 'Element' object has no attribute 'getroot'
有没有其他方法可以将 ElementTree 对象转换成 XML 字符串?
追溯:
Traceback (most recent call last):
File "Development/Python/REObjectSort/REObjectResolver.py", line 145, in <module>
cm = integrateDataWithCsv(cm, csvm)
File "Development/Python/REObjectSort/REObjectResolver.py", line 137, in integrateDataWithCsv
xmlstr = ElementTree.tostring(et.getroot(),encoding='utf8',method='xml')
AttributeError: 'Element' object has no attribute 'getroot'