python读取yml文件
class Read_data_class:
def read_yml_def(self, dir_path):
with open(dir_path, 'r', encoding='utf-8') as f:
yaml_list = yaml.safe_load(f)
return yaml_list
if __name__ == '__main__':
pass
class main():
path = os.path.join(os.path.dirname(__file__), '文件.yml')
data_yml = read_yml_data.Read_data_class().read_yml_def(path)