Unfortunately that didn't work either. I changed few lines in the previously sent code this way:
and now the dictionary looks like this:
-----------------------------------------------
{'8732': 'dtp-net', '4026': 'as-debug', '4448': 'asc-slmd', '4024': 'tnp1-port', '4025': 'partimage', '38203': 'agpolicy', '4023': 'esnm-zoning', '4020': 'trap', '4021': 'nexus-portal', '9418': 'git', '4028': 'dtserver-port', '4029': 'ip-qsig'}
-----------------------------------------------
The output line is like this:
but it gives this error message: KeyError: '62084', which doesn't tell me anything.
Code:
. . . port_table[port[0]]=line1[0] keycount +=1 content=f.readline() ports_name={} get_port_name ('Ports', ports_name)
-----------------------------------------------
{'8732': 'dtp-net', '4026': 'as-debug', '4448': 'asc-slmd', '4024': 'tnp1-port', '4025': 'partimage', '38203': 'agpolicy', '4023': 'esnm-zoning', '4020': 'trap', '4021': 'nexus-portal', '9418': 'git', '4028': 'dtserver-port', '4029': 'ip-qsig'}
-----------------------------------------------
The output line is like this:
Code:
outfile.write("\n".join(["%s %s %s" % (key, port_dic[key], ports_name[key]) for key in port_dic]))
Comment