hp-library/jsonsorting/verif3.py
2020-05-08 11:56:37 +02:00

34 lines
709 B
Python

#NOW FOR EACH LINE IN MATCHING LINES, IF LINE IN TXT FILE, REMOVE FROM TXT FILE
#lines to be deleted
matchinglines = open("1-matchinglines.txt")
matchinglines = matchinglines.readlines()
#lines not found in the two files
alllines = open("2-alllines.txt", "r")
alllines = alllines.readlines()
unmatchinglines = open("unmatchinglines.txt", "w+")
whatsleft = []
for line in alllines:
# print("=============")
# print(line)
for match in matchinglines:
# print(match)
# print("---------")
if match == line:
# print("True")
line = line.replace(match,"")
# print(line)
whatsleft.append(line)
whatsleft.sort()
# print(whatsleft)
for leftover in whatsleft:
unmatchinglines.write(leftover)