Sinisterly
Basic Anti Dupe Line Remover - Printable Version

+- Sinisterly (https://sinister.li)
+-- Forum: Coding (https://sinister.li/Forum-Coding)
+--- Forum: Python (https://sinister.li/Forum-Python)
+--- Thread: Basic Anti Dupe Line Remover (/Thread-Basic-Anti-Dupe-Line-Remover)



Basic Anti Dupe Line Remover - ENCRYP73D_GH05T - 12-22-2021

lines_seen = set() # holds lines already seen
with open("Output_file.txt", "w") as output_file:
for each_line in open("Input_file.txt", "r"):
    if each_line not in lines_seen: # check if line is not duplicate
        output_file.write(each_line)
        lines_seen.add(each_line)


just past it into file and save with .py extension


RE: Basic Anti Dupe Line Remover - mothered - 12-23-2021

Nice one.

I assume this will effectively remove dupes from combo lists?


RE: Basic Anti Dupe Line Remover - ENCRYP73D_GH05T - 12-23-2021

(12-23-2021, 01:32 AM)mothered Wrote: Nice one.

I assume this will effectively remove dupes from combo lists?

Yes Sir !! ignore trash coding tho


RE: Basic Anti Dupe Line Remover - mothered - 12-23-2021

(12-23-2021, 02:27 AM)ENCRYP73D_GH05T Wrote:
(12-23-2021, 01:32 AM)mothered Wrote: Nice one.

I assume this will effectively remove dupes from combo lists?

Yes Sir !! ignore trash coding tho
The coding Is fine. The main thing Is, It serves Its purpose.

Much appreciated