device = {}
device[‘ip_addr’] = ‘10.10.10.1’
print(device)
{‘ip_addr’: ‘10.10.10.1’}
dir(device) will list all method available
To loop over a dictionary you can do it by key or key value or both :
for key in device:
….print(key)
for value in device.values():
….print(key)
….print(value)
for key, value in device.items():
….print(key)
….print(value)