··python yaml模块
ipm中用于读取logger的配置文件
if not os.path.exists("logs/"):
os.mkdir('logs')
logging.basicConfig(level=log_level) # 调试debug级
with open("logging.yaml", 'rt') as f:
config = yaml.safe_load(f.read())
logging.config.dictConfig(config)
获取yaml文件信息
path = os.getcwd()
f = open(os.path.join(path, 'scratch.yml'), encoding='utf-8')
datas = yaml.load(f.read())
print(datas)
上述方法打开会有一个错误:YAMLLoadWarning: calling yaml.load() without Loader=… is deprecated, as the default Loader is unsafe. Please