I open two files and read the data from them into two lists
with open('file1.txt', 'r') as file:
data_list1 = [line.strip() for line in file]
with open('file2.txt', 'r') as file:
data_list2 = [line.strip() for line in file]
for each in list1:
if each in list2:
list1.remove(each)
After this I iterate over the first list and try to remove elements that also occur in the second list.
for each in data_list1:
print(each)
And I got repeated results from the second list.