def yaml_w(desired_caps):
# 将字典写入到yaml
curpath = f'{main.BASE_DIR}/quality_management_logic/commonCenter'
yamlpath = os.path.join(curpath, "caps.yaml")
# 写入到yaml文件
with open(yamlpath, "w", encoding="utf-8") as f:
yaml.dump(desired_caps, f)
def yaml_r():
curpath = f'{main.BASE_DIR}/quality_management_logic/commonCenter'
yamlpath = os.path.join(curpath, "caps.yaml")
f = open(yamlpath, 'r', encoding='utf-8')
cfg = f.read()
d = yaml.load(cfg,Loader=yaml.FullLoader) # 用load方法转字典
return d