Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # This tool is written to remove duplicate lines from a list of strings
- # I won't take credit for writing this, because I haven't, I found it somewhere in stackoverflow and I don't remember
- lines_seen = set()
- outfile = open("sorted.txt", "w")
- for line in open("list.txt", "r"):
- if line not in lines_seen:
- outfile.write(line)
- lines_seen.add(line)
- outfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement