import yaml


class Utils:
    @classmethod
    def get_yaml_data(cls,file_path):
        '''
        读取 yaml 文件
        :param file_path: 文件路径
        :return: 读取到的数据
        '''
        with open(file_path,"r",encoding="utf-8") as f:
            result = yaml.safe_load(f)
            print(f"文件内容为：{result}")
            return result

if __name__ == '__main__':
    yaml = Utils.get_yaml_data("E:/霍格沃兹测试/test/book_project/datas/book_info.yaml").get("add").get("P1").get("data")
    print(F"读取到的数据是：{yaml}")