import re


def parse(fname, fields):
    result = {}
    field = None
    with open(fname, "rt", encoding="utf-8") as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            if line.endswith(":"):
                field = line[:-1] if line[:-1] in fields else None
                if field:
                    result[field] = []
            elif field:
                number, text = line.split(None, 1)
                result[field].append((float(number), text))
    return result
if "__main__" == __name__:
    print(parse("domains", ("ip_s", "ip_d")))
72510e5548c6a9279f26d578593d2c7d695e6299
<mask token>

<mask token>


def parse(fname, fields):
    result = {}
    field = None
    with open(fname, 'rt', encoding='utf-8') as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            if line.endswith(':'):
                field = line[:-1] if line[:-1] in fields else None
                if field:
                    result[field] = []
            elif field:
                number, text = line.split(None, 1)
                result[field].append((float(number), text))
    return result


<mask token>

<mask token>


def parse(fname, fields):
    result = {}
    field = None
    with open(fname, 'rt', encoding='utf-8') as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            if line.endswith(':'):
                field = line[:-1] if line[:-1] in fields else None
                if field:
                    result[field] = []
            elif field:
                number, text = line.split(None, 1)
                result[field].append((float(number), text))
    return result


if '__main__' == __name__:
    print(parse('domains', ('ip_s', 'ip_d')))

import re


def parse(fname, fields):
    result = {}
    field = None
    with open(fname, 'rt', encoding='utf-8') as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            if line.endswith(':'):
                field = line[:-1] if line[:-1] in fields else None
                if field:
                    result[field] = []
            elif field:
                number, text = line.split(None, 1)
                result[field].append((float(number), text))
    return result


if '__main__' == __name__:
    print(parse('domains', ('ip_s', 'ip_d')))

import re


def parse(fname, fields):
    result = {}
    field = None
    with open(fname, "rt", encoding="utf-8") as f:
        for line in f:
            line = line.strip()
            if not line:
                continue
            if line.endswith(":"):
                field = line[:-1] if line[:-1] in fields else None
                if field:
                    result[field] = []
            elif field:
                number, text = line.split(None, 1)
                result[field].append((float(number), text))
    return result
if "__main__" == __name__:
    print(parse("domains", ("ip_s", "ip_d")))