Untitled

mail@pastecode.io avatar
unknown
python
2 years ago
465 B
0
Indexable
Never
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)