直接上代码
with open(main_yaml_path, "r") as yaml_file:
yaml_obj = yaml.load(yaml_file.read())
yaml_obj['configure']['version'] = mir_version
yaml_obj['configure']['env_type'] = env_type
yaml_obj['feedback']['offline_url'] = offline_url
main_yaml = open(main_yaml_path, 'w')
yaml.dump(yaml_obj, main_yaml)
main_yaml.close()