def readfileintodict(filename, d):
    with open(filename, 'r') as f:
        lines = f.readlines()
    for l in lines:
        if l[:1] == '#':
            continue
        try:
            key, value = l.split('=', 1)
            d[key] = value.strip()
        except ValueError:
            pass
Read key=value pairs from a file, into a dict.
dataset/ETHPy150Open coreemu/core/daemon/core/misc/utils.py/readfileintodict