Jul-25-2018, 12:18 PM
use string
for print you may use something like this, more pythonic
https://stackoverflow.com/a/26937531/4046632
(Jul-25-2018, 11:18 AM)anna Wrote: is this ok?well, that is a question only you can answer. Does it look like YOU want it?
for print you may use something like this, more pythonic
neighbours = [{'ip': '172.21.162.164', 'hostname': 'PUN-DIG-DIG-01-ONN-BR-BS-GL-01', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/18'}, {'ip': '172.21.162.157', 'hostname': 'PUN-DIG-DIG-02-ONN-BR-BS-01', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/15'}, {'ip': '172.21.162.71', 'hostname': 'PUN-DIG-DIG-01-ONN-BR-BS-70', 'remote_port': 'FastEthernet0/24', 'local_port': 'FastEthernet0/19'}, {'ip': '172.21.160.2', 'hostname': 'pu-dig-dig-r1-as01', 'remote_port': 'GigabitEthernet1/0/9', 'local_port': 'GigabitEthernet0/1'}] my_ip = "172.21.160.3" for item in neighbours: print('{my_ip}\t{ip}\t{hostname: <30}\t{remote_port}\t{local_port}'.format(my_ip=my_ip, **item))or use some of the avalable packages for print tabular data:
https://stackoverflow.com/a/26937531/4046632
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs