-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dup_check.py
36 lines (28 loc) · 897 Bytes
/
Dup_check.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
def check_duplicates(filename):
"""Checks for duplicate entries in a text file.
Args:
filename: The path to the text file.
Returns:
A list of duplicate entries, or an empty list if no duplicates are found.
"""
with open(filename, "r", newline="\n") as file:
lines = file.readlines()
seen = set()
duplicates = []
for line in lines:
line = line.strip() # Remove leading/trailing whitespace
if line in seen:
duplicates.append(line)
else:
seen.add(line)
return duplicates
# Get the filename from the user
filename = "vie-personal_dehashed_dict.txt" # Replace with your actual file name
# Check for duplicates
duplicates = check_duplicates(filename)
if duplicates:
print("Duplicate entries found:")
for duplicate in duplicates:
print(duplicate)
else:
print("No duplicate entries found.")