contacts battle works...

This commit is contained in:
sShemet
2026-02-02 19:30:44 +05:00
parent f16790c733
commit 8db81fd04d
1587 changed files with 32042 additions and 242 deletions

View File

@@ -0,0 +1,30 @@
import os
import json
import hashlib
# Создаем словарь для группировки
file_groups = {}
# Ищем все .txt файлы
for filename in [f for f in os.listdir('.') if f.endswith('.txt') and os.path.isfile(f)]:
try:
with open(filename, 'rb') as f:
content = f.read()
file_hash = hashlib.md5(content).hexdigest()
# Добавляем в группу
file_groups.setdefault(file_hash, []).append(filename)
except:
pass
# Преобразуем в нужный формат
result = list(file_groups.values())
# Сохраняем в JSON
with open("contacts_copy.json", 'w') as f:
json.dump(result, f, indent=2)
# Выводим статистику
print(f"Найдено файлов: {sum(len(g) for g in result)}")
print(f"Создано групп: {len(result)}")
print(f"Сохранено в contacts_copy.json")