atool.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:bat 作者: braunfuss 项目源码 文件源码
def readConfig(EventPath):

    Config = {}
    logger.info('\033[31m Parsing ConfigFile \033[0m \n')
    try:
        for i in os.listdir(EventPath):
            if fnmatch.fnmatch(i, '*.config'):
                evfile = os.path.join(EventPath,i)
        fobj = open(evfile, 'r')

        for line in fobj:
            if line[0] != '#' and len(line) > 1:
                line = str.split(line, '=')
                key  = (line[0].replace('\'', '')).strip()
                value = line[1].replace('\n','').strip()

                Config[key] = value

    except:
        logger.info('\033[31m File Error Exception \033[0m \n')

    return Config
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号