this may seem like a trivial and already asked question, but perhaps it might be helpful. And I should point out that it relates to a question already asked for which I provide the link comparing two text files and remove duplicates in python
Problem: I have two.txt files that contain, both, words provided in lists (columns, about 3). Now, I have taken advantage of the script that I attach and which is based on the conversation in the link, though it doesn't actually return me a file that is the result of the comparison.
Let me explain: the goal is to generate a file that has both words from the two files but without duplicates.
I hope I have been sufficiently clear and I thank anyone of good will who wants to help me.
With this, doesn't work with my goal
with open("TEXT1.txt") as f1:
set1 = set(f1.readlines())
with open("TEXT2.txt") as f2:
set2 = set(f2.readlines())
nondups = set1 - set2
with open("MERGED.txt", "w") as out:
out.writelines(nondups)