在解析接收"的xml文件时xml.etree.ElementTree.ParseError:格式不正确"

时间:2018-02-12 16:21:33

标签: python python-3.x

import xml.etree.cElementTree as ET
def get_attr_number(node):
    root=ET.fromstring(node)
    length=0
    for i in root:
        l=len(i.attrib)
        length+=l
    print (length)

if __name__=="__main__":
    n=int(input())
    for i in range(n):
        node=input()
        print (node)
        get_attr_number(node)

我无法将xml字符串传递给函数here.Kindly帮助我。 提前谢谢!

0 个答案:

没有答案