File size: 604 Bytes
d6be317 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
def remove_duplicates(input_file, output_file):
with open(input_file, 'r') as file:
lines = file.readlines()
unique_lines = set()
with open(output_file, 'w') as file:
for line in lines:
if line not in unique_lines:
file.write(line)
unique_lines.add(line)
if __name__ == "__main__":
import sys
if len(sys.argv) != 2:
print("Usage: python remove_duplicates.py <input_file>")
sys.exit(1)
input_file = sys.argv[1]
output_file = 'output_no_duplicates.txt'
remove_duplicates(input_file, output_file) |