I have a multidimensional list with a layout like this
['Company Name', ['companyemail@email.com']]
['Company Name', ['companyemail@email.com','companyemail@email.com']]
['Company Name', ['companyemail@email.com']]
There are about 500 of these lines in the list. However due to the inefficiencies of the corporate world, some vendors haven provide credible contact info and this is the result:
['Company Name', ['companyemail@email.com']]
['Company Name', ['companyemail@email.com','companyemail@email.com']]
['Company Name', []]
['Company Name', []]
I have created a for loop which checks if the second element in the list a certain spot is empty, however it seems like 80% through the list it stops removing elements that are supposed to be removed.
I think I know why its doing this, and its because how my for loop is:
count=0
for k in (list1):
if not list1[count][1]:
list1.pop(count)
else:
count+=1
It used to be:
count=0
for k in (list1):
if not list1[count][1]:
list1.pop(count)
count+=1
but i had to change it because i noticed if there were items in the list that needed to be removed and they were right next to each other the second would be skipped because the count variable would add 1 while the location of the item would go back one.