0
点赞
收藏
分享

微信扫一扫

Pytest学习-读取YAML文件

hwwjian 2022-08-06 阅读 101

#!/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 条评论