使用ElementTree解析XML“ xml.parsers.expat.ExpatError:格式不正确(无效令牌)”

时间:2019-02-14 14:29:17

标签: xml python-3.x elementtree

我遵循此线程的帮助。 How do I get Python's ElementTree to pretty print to an XML file?

但是我有一个我不明白的错误。

错误

css: [
    '@/assets/main.scss',
]

代码

File "myprogram.py", line 505, in get_phyloxml_extended
xmlstr = minidom.parseString(ET.tostring(root).decode("utf-8")).toprettyxml(indent="   ")
File "/usr/lib/python3.6/xml/dom/minidom.py", line 1968, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python3.6/xml/dom/expatbuilder.py", line 925, in parseString
return builder.parseString(string)
File "/usr/lib/python3.6/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: not well-formed (invalid token): line 1, column 425

1 个答案:

答案 0 :(得分:0)

标签之一是数字,所以它不起作用.....

<phy:00000001>2.0<phy:00000001>一样不起作用

但是...

但是...

<phy:a00000001>2.0<phy:a00000001>的工作-'