ips = {}
with open('today', 'r') as myFile:
    for line in myFile:
        parts = line.split(' ')
if parts[1] == 'Failure':
    if parts[0] in ips:
        ips[pars[0]] += 1
else:
    ips[parts[0]] = 0
Python Сохранить в файл