gpt4 book ai didi

python - 'lxml.etree._Element' 对象没有属性 'write' ??? (PYTHON)

转载 作者:太空狗 更新时间:2023-10-30 01:44:53 26 4
gpt4 key购买 nike

<分区>

from lxml import etree

root = etree.Element('root1')
element = etree.SubElement(root, 'element1')
root.write( 'xmltree.xml' )

错误:

AttributeError: 'lxml.etree._Element' object has no attribute 'write'

我该如何解决这个问题?

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com