I have this code:
for lineSDR in sorted_dates_removed:
for lineFFL in final_to_find_list:
if lineSDR in lineFFL:
index1= final_to_find_list.index(lineFFL)
final_to_find_list.pop(index1)
When I print this the final_to_find_list had doubled instead of gotten smaller. It is my understanding that the for loop and the "pop" combo is causing the indices to change each time the for loop starts again. I don't know that may be wrong, but it is not doing what I want which is to take the strings that match between both lists OUT of final_to_find_list. Thanks
list1= ['a','b','c','d','e']
list2= ['a','b','c','d','e','f']
for line1 in list1:
for line2 in list2:
if line1 in line2:
index1= list2.index(line2)
list2.pop(index1)
This prints ['f']. But for some reason it doesn't work for my larger lists.