#!/usr/bin/env python # -*- coding: UTF-8 -*- """ @Project :Pytest @File :read_data.py @IDE :PyCharm @Author :zhou @Date :2022/8/6 19:05 """ import yaml # 获取文件 f = open ( "../config/data.yaml" , encoding = "utf-8" ) # 读取
# -*- coding: UTF-8 -*-
"""
@Project :Pytest
@File :read_data.py
@IDE :PyCharm
@Author :zhou
@Date :2022/8/6 19:05
"""
import yaml
# 获取文件
f = open("../config/data.yaml", encoding="utf-8")
# 读取文件内容
data = yaml.safe_load(f)
# 其实data是字典格式数据
print(data["person"])