Files
test_mail/check_duplicates.py
2025-10-01 10:30:11 +05:00

22 lines
917 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import csv
from collections import Counter
contacts = list(csv.DictReader(open('contacts_mailru.csv', encoding='utf-8')))
emails = [c['E-mail Address'] for c in contacts]
counter = Counter(emails)
duplicates = {email: count for email, count in counter.items() if count > 1}
print(f'Всего контактов в файле: {len(contacts)}')
print(f'Уникальных email: {len(counter)}')
print(f'Дубликатов: {len(duplicates)}')
if duplicates:
print('\nДублирующиеся email:')
for email, count in sorted(duplicates.items()):
print(f' {email}: {count} раз')
else:
print('\nДубликатов не найдено')
print(f'\nРазница: {len(contacts)} - {len(counter)} = {len(contacts) - len(counter)} дубликатов')
print(f'Если Mail.ru показывает 101 контакт, разница: {len(counter)} - 101 = {len(counter) - 101}')