是否有按索引将子元素的etree对象集拆分为多个etree对象的函数?例如,如果我的根节点有400个子节点,每个子节点都有后代,那么我可以从文件的每一秒中获取4个etree对象吗?
from lxml import etree as ET
tree = ET.parse('FileName.xml')
root = tree.getroot()
firstquarter = root.getchildren() #function to get 0-100 of the child nodes
secondquarter = root.getchildren() #function to get 101-200 of the child nodes
thirdquarter = root.getchildren() #function to get 201-300 of the child nodes
fourthquarter = root.getchildren() #function to get 301-400 of the child nodes发布于 2020-08-03 19:31:32
你应该可以简单地做一些类似的事情
firstquarter = root.getchildren()[0:100]等。
https://stackoverflow.com/questions/63235642
复制相似问题