utils.py 431 字节
Newer Older
Eric.Lee2021's avatar
Eric.Lee2021 已提交
1 2 3 4 5 6
import os

"""Parses the data configuration file"""
def parse_data_cfg(path):
    print('data_cfg : ',path)
    options = dict()
Eric.Lee2021's avatar
Eric.Lee2021 已提交
7
    with open(path, 'r',encoding='UTF-8') as fp:
Eric.Lee2021's avatar
Eric.Lee2021 已提交
8 9 10 11 12 13 14 15
        lines = fp.readlines()
    for line in lines:
        line = line.strip()
        if line == '' or line.startswith('#'):
            continue
        key, value = line.split('=')
        options[key.strip()] = value.strip()
    return options