Untitled

 avatar
unknown
python
3 years ago
418 B
5
Indexable
import xml.etree.ElementTree as ET
tree = ET.parse('config.xml')
root = tree.getroot()

for dhcpd in root.findall('dhcpd'):
    for staticmap in dhcpd.iter('staticmap'):
        for ipaddr in staticmap.iter('ipaddr'):
            for mac in staticmap.iter('mac'):
                for desc in staticmap.iter('descr'):

                    print('IP Adress: ',ipaddr.text,'Mac Adress:',mac.text,'Description:',desc.text)
Editor is loading...