# -*- coding: utf-8 -*- # @Time : 2024/5/17 # @Author : 魏志亮 import os import yaml def read_yaml_file(filename, type): path = os.path.abspath(__file__) for i in range(3): path = os.path.dirname(path) with open(path + os.sep + "config_files" + os.sep + filename + os.sep + type + ".yaml", 'r', encoding='utf-8') as f: return yaml.safe_load(f) def read_param_from_config(conf, type, default_value=None): if type in conf: return conf[type] else: return default_value if __name__ == '__main__': yaml_files = os.listdir("../../config_files") types = ['second', 'minute'] print(yaml_files)