Hello,
I'm not used to what appears to be a nested dictionary in a list, and can't find how to get the keys and values:
Thank you.
I'm not used to what appears to be a nested dictionary in a list, and can't find how to get the keys and values:
for x in ifaddr.get_adapters(): print(x) """ Adapter(name='{FC153F79-475E-430D-B95A-06E966794B49}', nice_name='Realtek PCIe GbE Family Controller', ips=[IP(ip=('2a01:e0a:590:fd80:1a08:50b2:881d:2947', 0, 0), network_prefix=64, nice_name='Ethernet'), IP(ip=('fe80::6b43:963:5027:aacd', 0, 20), network_prefix=64, nice_name='Ethernet'), IP(ip='192.168.0.16', network_prefix=24, nice_name='Ethernet')], index=20) """ #AttributeError: 'Adapter' object has no attribute 'items' for key, value in x.items() : print(key) #TypeError: 'Adapter' object is not iterable #for y in x: #AttributeError: 'Adapter' object has no attribute 'items' """ for y in x.items(): print(y + ':', x[y]) """ #TypeError: 'Adapter' object is not subscriptable #print(x[0])I need to grab each adapter's nice_name. Does someone know?Thank you.
