Python中文
首页
教程
问答
标签
搜索
登录
注册
_ElementInterface实例没有属性“tostring”
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<p>下面的代码生成此错误。我不明白为什么。如果ElementTree有parse,为什么它不需要string呢?<a href="http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree" rel="nofollow noreferrer">http://docs.python.org/library/xml.etree.elementtree.html#xml.etree.ElementTree.ElementTree</a></p> <pre><code>from xml.etree.ElementTree import ElementTree ... tree = ElementTree() node = ElementTree() node = tree.parse(open("my_xml.xml")) text = node.tostring() </code></pre>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>链接到的文档不支持存在<code>ElementTree.tostring()</code>方法。</p> <p>另外,您对<code>tree.parse()</code>的调用将重新绑定<code>node</code>。</p>
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
Python猜字gam
8 回答
Python猜字游戏
3 回答
Python猜字游戏?
9 回答
Python猜字游戏不会在玩家猜测所有字母时结束
1 回答
Python猜字游戏在有重复字符的单词上失败
3 回答
Python猜想
6 回答
Python猜数字游戏,而循环没有响应
2 回答
python猜测gam的代码反馈
2 回答
python猜测gam的变量问题
10 回答
python猜测具体路径?
10 回答
Python猜测我的号码(反向号码猜测)UnboundLocalE
3 回答
python猜测该数字在猜测过度后再试一次
2 回答
Python猜猜单词游戏bug
4 回答
Python猜猜游戏如何再现
9 回答
Python猜猜游戏服务器
5 回答
Python猜猜谁的游戏我没有得到我预期的输出
5 回答
Python猜谜游戏
5 回答
Python猜谜游戏,值错误:randrange()的空范围
9 回答
Python猜谜游戏,带尝试选项
3 回答
Python猜谜游戏,我的赢的条件打印赢和输
7 回答