Dictionery week 4 ,
## Create a dic in python
net_device = {}
type(net_device)
## add keys
net_device['ip_addr'] = '192.1.1.1'
net_device = {'ip_addr' : '192.1.1.2'}
var1 = 'vendor'
net_device[var1] = 'cisco'
net_device['device_type'] = 'ios'
### access key values
net_device['device_type']
net_device['vendor']
net_device['vendor'] = 'juniper' ## change key ## if key dont exist, python will info with KeyError
net_device2 = net_device
net_device2 is net_device ## Is the same thing in memory... look up.
#######
net_device is net_device2
net_device2 = net_device.copy()
print(net_device.get('module', '811'))
dir()
net_device.pop('model')
net_device2 = {'model' : '881'}
net_device.update(net_device2)
for key in net_device:
print(key)
for v in net_device.values():
print(v)
for key , value in net_device.items():
print(key)
print(value)
print('-' * 30)