Created
August 17, 2021 06:25
-
-
Save InputBlackBoxOutput/b0ff7b6bb25930ab9286f880f37a9d33 to your computer and use it in GitHub Desktop.
Python program to remove duplicate entries in a text or CSV file
This file contains hidden or 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
with open("text.txt", 'r') as infile: | |
data = infile.read().splitlines() | |
# print(data) | |
with open("text.txt", 'w') as outfile: | |
for each in list(set(data)): | |
outfile.write(each + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment