Есть такой код:
access = {'FastEthernet0/12': 10,
'FastEthernet0/14': 11,
'FastEthernet0/16': 17,
'FastEthernet0/17': 150}
access_template = ['switchport mode access',
'switchport access vlan',
'switchport nonegotiate',
'spanning-tree portfast',
'spanning-tree bpduguard enable']
a = []
access_conf = {}
for port in access:
a.clear()
for conf in access_template:
if conf == 'switchport access vlan':
a.append(str(conf) + ' ' + str(access[port]))
else:
a.append(conf)
# access_conf.append(a)
access_conf[port] = (a)
print(access_conf)Необходимо, чтобы
access_conf = {'FastEthernet0/12': ['switchport mode access', 'switchport access vlan 10', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/14': ['switchport mode access', 'switchport access vlan 11', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/16': ['switchport mode access', 'switchport access vlan 17', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/17': ['switchport mode access', 'switchport access vlan 150', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable']}{'FastEthernet0/12': ['switchport mode access', 'switchport access vlan 150', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/14': ['switchport mode access', 'switchport access vlan 150', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/16': ['switchport mode access', 'switchport access vlan 150', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable'], 'FastEthernet0/17': ['switchport mode access', 'switchport access vlan 150', 'switchport nonegotiate', 'spanning-tree portfast', 'spanning-tree bpduguard enable']}Python 3.6.1
Подскажите, что не так?
вот возможное решение