相关疑难解决方法(0)

如何在python中将任何数据类型更改为字符串

如何在Python中将任何数据类型更改为字符串?

python

119
推荐指数
6
解决办法
40万
查看次数

将Python ElementTree转换为字符串

每当我打电话时ElementTree.tostring(e),都会收到以下错误消息:

AttributeError: 'Element' object has no attribute 'getroot'
Run Code Online (Sandbox Code Playgroud)

有没有其他方法将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'
Run Code Online (Sandbox Code Playgroud)

python xml marshalling elementtree

67
推荐指数
2
解决办法
11万
查看次数

标签 统计

python ×2

elementtree ×1

marshalling ×1

xml ×1