Поиск дубликатов внутри файла Python

Поиск повторяющихся строк. Исходник написан на Python import os ## Move into the directory where the database is. os.chdir(‘folder where file is’) open_file = open(‘candidates.txt’, ‘r’) line = open_file.readline() name = line.strip() candidateDict = {} def find_duplicate(): for name in open_file: if candidateDict.has_key(name): candidateDict[name] += 1 else: candidateDict[name] = 1 find_duplicate() for name in candidateDict:… Читать далее Поиск дубликатов внутри файла Python

Опубликовано
В рубрике Новости Отмечено