python-yaml
配置文件:
# 字典
platformVersion : 7.1
platformName : Android
deviceName :
name : 11
sex : hehe
age : 13
demo:
- hello
- yaml
- yeah
test : ttttt
文件获取:
import yaml
fs = open("caps.yaml")
res = yaml.full_load(fs)
print(res)
执行结果:
{'platformVersion': 7.1, 'platformName': 'Android', 'deviceName': {'name': 11, 'sex': 'hehe', 'age': 13}, 'demo': ['hello', 'yaml', 'yeah'], 'test': 'ttttt'}