Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
loop printing twice
#2
issue found in below code, now its resolved.

with open('dslamips.txt') as ipdatafile:
         for sr_no, line in enumerate(ipdatafile, start=1):
             for ips in dslamip_list:
                 to_bematch_ip = line.strip().split(' ')[2]
                 if ips == to_bematch_ip:
                    dslamInterface = "gigabitEthernet "+(line.strip().split(' ')[-1].strip()[len("GigabitEthernet"):])
                    insert_DSLAM_dataInDB(dslamInterface,ips)
                    #print("ip={} {} {}".format(ips,sr_no,line))
Reply


Messages In This Thread
loop printing twice - by anna - Aug-27-2019, 07:14 AM
RE: loop printing twice - by anna - Sep-04-2019, 09:13 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  dict printing last key,value out of loop anna 6 3,354 Feb-23-2019, 03:22 AM
Last Post: anna

Forum Jump:

User Panel Messages

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