IFRAME SYNC
def remove_duplicates(input_file, output_file):
# Open the input file in read mode
with open(input_file, 'r') as file:
# Read all lines from the file
lines = file.readlines()
# Use a set to keep track of unique lines
unique_lines = set()
# Iterate through the lines and add non-duplicate lines to the set
for line in lines:
unique_lines.add(line)
# Open the output file in write mode
with open(output_file, 'w') as file:
# Write the unique lines back to the file
file.writelines(unique_lines)
# Example usage
input_file_path = 'input.txt' # Replace with the path to your input file
output_file_path = 'output.txt' # Replace with the path to your output file
remove_duplicates(input_file_path, output_file_path)
IFRAME SYNC
Comments
Post a Comment