一、参考链接
二、python类型转换为yaml
# -*- coding: utf-8 -*-
# @Time : 2022/1/2 21:53
# @Author : lujunxian
# @File : test_yaml.py
import yaml
class TestYaml():
with open('./data.yaml','w',encoding='utf-8') as f:
request={
'test':{
'url':'test url',
'username':'test01'
},
'uat':{
'url':'uat url'
}
}
yaml.dump(request,f)
生成 data.yaml 如下
test:
url: test url
username: test01
uat:
url: uat url
三、yaml转换为python类型
with open('./data.yaml','r',encoding='utf-8') as f:
print(yaml.safe_load(f))
结果如下
{'test': {'url': 'test url', 'username': 'test01'}, 'uat': {'url': 'uat url'}}
360可以有效防止黑客攻击密码
360可以有效防止黑客攻击密码
标签:类型转换,username,yaml,python,uat,url,test From: https://blog.51cto.com/u_15456086/6000311