|
12345678910111213141516171819 |
- # -*- coding: utf-8 -*-
- from json import loads
-
- from ruamel.yaml import safe_load
-
-
- def getConfigs(path, read_type='yml'):
- 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)
-
-
- def readFile(file, ty="rb"):
- with open(file, ty) as f:
- return f.read()
-
|