Last active
August 1, 2023 10:59
-
-
Save movalex/7ca186eddde741c8e6c5e8d6f94a9484 to your computer and use it in GitHub Desktop.
Compare two files and create file with unique lines
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def find_unique(a, b): | |
return [item for item in b if item not in a] | |
a = open("file1.txt", "rb").readlines() | |
b = open("file2.txt", "rb").readlines() | |
with open("out.txt", "wb") as f: | |
unique_lines = find_unique(a, b) | |
for line in unique_lines: | |
f.write(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment