Pytest学习-读取YAML文件

hwwjian

关注

阅读 101

2022-08-06

#!/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")
# 读取文件内容
data = yaml.safe_load(f)
# 其实data是字典格式数据
print(data["person"])

Pytest学习-读取YAML文件_Pytest

精彩评论(0)

0 0 举报