读取yaml文件

读取yaml文件

# -*- coding: utf-8 -*-
"""
@Time    : 2021/7/20 11:34
@Author  : Little Duo
@File    : Tools.py
"""

import yaml


def readYmlFile(yamlFilePath):
    """
    读取yaml文件

    :param yamlFilePath: 配置文件路径
    :return: dict
    """
    try:
        with open(yamlFilePath, mode='r', encoding='utf8') as f:
            fileContent = f.read()
            return yaml.load(fileContent, Loader=yaml.FullLoader)
    except Exception as e:
        print(e)

posted @ 2023-02-28 14:32  LittleDuo  阅读(79)  评论(0)    收藏  举报