|
- # -*- coding: utf-8 -*-
- from json import loads
- from os.path import join
-
- from yaml import safe_load
-
-
- def getConfigs(base_dir, file_path, read_type='json'):
- path = join(base_dir, file_path)
- with open(path, 'r', encoding="utf-8") as f:
- if read_type == 'json':
- return loads(f.read())
- if read_type == 'yml':
- return safe_load(f)
- raise Exception('路径: %s未获取配置信息' % path)
|