xml转python_python如何把xml⽂件转化成string 展开全部
你说的不是xml⽂件吧,是xml对象转化成string吧。
你可以使⽤toxml()这个⽅法。l([encoding])
"""
Return the XML that the DOM represents as a string.
With no argument, the XML header does not specify an encoding, and the result is
Unicode string if the default encoding cannot represent all characters in the
document. Encoding this string in an encoding other than UTF-8 is likely
incorrect, since UTF-8 is the default encoding of XML.
With an explicit encoding [1] argument, the result is a byte string in the
python处理xml文件specified encoding. It is recommended that this argument is always specified. To
avoid UnicodeError exceptions in case of unrepresentable text data, the
encoding argument should be specified as “utf-8”.
Changed in version 2.3: the encoding argument was introduced; see writexml().
"""
如果解决了您的问题请采纳!
如果未32313133353236313431303231363533e58685e5aeb931333337383266解决请继续追问
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论