XML 1 - Find the Score

  • + 0 comments
    def get_attr_number(node):
        attrs = len(node.attrib)
        if len(node) == 0:
            return attrs
        return attrs + sum(get_attr_number(child) for child in node)