I am trying to split 2 lists, compare them and make a new list without the succesfully compared items in 2 lists.
So lets say List_1.txt =
Failed = abc
Failed = hfi
Failed = kdi
and List_2.txt =
1:1:1 - jdsfjdf
2:2:2 - iidf
3:3:3 - abc
6:3:1 - hfi
8:2:1 - kdi
3:1:5 - dua
3:1:2 - dfh
I want to compare those lists and make a new_list2 without the list_1 entries.
what I tried was:
treinrit = open('List_1', 'r')
lijna = treinrit.readlines()
treinrit.close()
annuleer_treinrit = open('List_2', 'r')
lijnb = annuleer_treinrit.readline()
annuleer_treinrit.close()
lijsta = []
lijstb = []
for a in lijna:
clean = a.split(' - ')
print(lijsta)
for b in lijnb:
lijstb.append(lijnb.split(": "))
I just cant get the list to split properly. I only need the last bit of each file to compare but I don't know how.