我有要求-基于对xml文件子节点的文本搜索,将文件名打印为输出。我已经编写了以下代码,但没有得到任何输出:
content = elt.parse('/tmp/{}'.format(file_name)).getroot()
#all_items = content.findall("70443783")
#print(all_items)
for elem in content:
for subelem in elem.findall('StartDateTime'):
( start Datetime is text I want to search in child nodes of xml file)
print(subelem.text) or print the name of file will be fine
as well.