Python Forum
ciscolib cdp output list printing support
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ciscolib cdp output list printing support
#3
thanks, Buran, sorry for such boring question... I am not full time coder and weak at list and dict.

Hi Buran,

is this ok? please suggest



import ciscolib
ip = "172.21.160.3"
switch = ciscolib.Device(ip, "test123", "anna")
switch.connect()
ne= switch.get_neighbors()
for item in ne:
    print ip+"\t"+item['ip']+"\t"+item['hostname']+"\t"+item['remote_port']+"\t"+item['local_port']
Output:
172.21.160.3 172.21.162.164 PUN-DIG-DIG-01-ONN-BR-BS-GL-01 FastEthernet0/24 FastEthernet0/18 172.21.160.3 172.21.162.157 PUN-DIG-DIG-02-ONN-BR-BS-01 FastEthernet0/24 FastEthernet0/15 172.21.160.3 172.21.162.71 PUN-DIG-DIG-01-ONN-BR-BS-70 FastEthernet0/24 FastEthernet0/19 172.21.160.3 172.21.160.2 pu-dig-dig-r1-as01 GigabitEthernet1/0/9 GigabitEthernet0/1
Reply


Messages In This Thread
ciscolib cdp output list printing support - by anna - Jul-25-2018, 10:55 AM
RE: ciscolib cdp output list printing support - by anna - Jul-25-2018, 11:18 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  sum() list from SQLAlchemy output Personne 5 4,616 May-17-2022, 12:25 AM
Last Post: Personne
Question Printing through list.. again jesse68 2 1,190 Apr-16-2022, 03:24 PM
Last Post: jesse68
  help for list printing jip31 8 3,734 May-01-2021, 03:52 AM
Last Post: Pedroski55
  Problem printing last element from a list tester_V 3 2,466 Oct-30-2020, 04:54 AM
Last Post: tester_V
  Printing empty list? hhydration 2 2,160 Oct-28-2020, 11:34 AM
Last Post: Atekka
  How to append to list a function output? rama27 5 6,859 Aug-24-2020, 10:53 AM
Last Post: DeaD_EyE
  Printing images from a list Heyjoe 4 2,905 Jun-22-2020, 02:28 AM
Last Post: Heyjoe
  json.dumps list output qurr 12 5,368 Apr-08-2020, 10:13 PM
Last Post: micseydel
  If item in list = true, Output = xx kroh 0 1,524 Feb-19-2020, 09:17 AM
Last Post: kroh
  printing a list contents without brackets in a print statement paracelx 1 2,170 Feb-15-2020, 02:15 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020