Advertisement
Guest User

Untitled

a guest
Jul 19th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. # This tool is written to remove duplicate lines from a list of strings
  2. # I won't take credit for writing this, because I haven't, I found it somewhere in stackoverflow and I don't remember
  3.  
  4. lines_seen = set()
  5. outfile = open("sorted.txt", "w")
  6. for line in open("list.txt", "r"):
  7. if line not in lines_seen:
  8. outfile.write(line)
  9. lines_seen.add(line)
  10. outfile.close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement