Код: Выделить всё
xml = etree.parse(args.file).getroot()
el = xml.find(".//cims:Period", tools.namespaces)
log.info(f"number of elements under Period:{len(el)}") # correct
log.info(etree.tostring(el, pretty_print=True).decode())
el = el.find(".//cims:Point", tools.namespaces)
log.info(f"number of elements in Point:{len(el)}") # should this not be 96?
log.info(etree.tostring(el, pretty_print=True).decode())
Код: Выделить всё
number of elements under Period:98
2026-02-16T23:00Z
2026-02-17T23:00Z
PT15M
1
0.0
:
96
13.0
Код: Выделить всё
number of elements in Point:2
1
0.0
Подробнее здесь: https://stackoverflow.com/questions/798 ... -the-xpath
Мобильная версия