2018-01-07 01:54:36 +00:00
|
|
|
# -*- coding: utf8 -*-
|
2019-01-16 13:20:56 +00:00
|
|
|
from config import configCommon
|
|
|
|
|
2018-01-07 01:54:36 +00:00
|
|
|
__author__ = 'MR.wen'
|
|
|
|
import os
|
|
|
|
import yaml
|
2018-01-20 15:27:24 +00:00
|
|
|
|
2018-01-07 01:54:36 +00:00
|
|
|
|
|
|
|
def _get_yaml():
|
|
|
|
"""
|
|
|
|
解析yaml
|
|
|
|
:return: s 字典
|
|
|
|
"""
|
|
|
|
path = os.path.join(os.path.dirname(__file__) + '/ticket_config.yaml')
|
2019-01-16 13:20:56 +00:00
|
|
|
try: # 兼容2和3版本
|
|
|
|
with open(path, encoding="utf-8") as f:
|
2019-05-07 03:06:34 +00:00
|
|
|
s = yaml.load(f, Loader=yaml.FullLoader)
|
2019-01-17 07:33:10 +00:00
|
|
|
except Exception:
|
2019-01-16 13:20:56 +00:00
|
|
|
with open(path) as f:
|
2019-05-07 03:06:34 +00:00
|
|
|
s = yaml.load(f, Loader=yaml.FullLoader)
|
2019-01-07 09:48:41 +00:00
|
|
|
return s.decode() if isinstance(s, bytes) else s
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
print(_get_yaml())
|