Apr-05-2022, 08:09 PM
Hi all,
I have this :
How can I do that using ElementTree? I tried find and findall but did not work.
I have this :
>>> import xml.etree.ElementTree as ET
>>> tree = ET.parse('disks.xml')
>>> root = tree.getroot()
>>> root.tag
'cli-output'
>>> root.attrib
{}
>>> for context in root.iter('context'):
... print(context.attrib)
...
{'cell': 'celadm04'}But I want to get only this value "celadm04" and add to a variable. How can I do that using ElementTree? I tried find and findall but did not work.
