def writeBackToFile(filename, itempath, itemattr, value):
"""
write the value of an item's attribute back to the yaml-file
:param filename: name of the yaml-file (without the .yaml extension!)
:param itempath: path of the item to modify
:param itemattr: name of the item's attribute to modify
:param value: new value for the attribute
:return: formatted string
"""
itemyamlfile = yamlfile(filename)
if os.path.isfile(filename+YAML_FILE):
itemyamlfile.load()
itemyamlfile.setleafvalue(itempath, itemattr, value)
itemyamlfile.save()
# ==================================================================================
# class yamlfile (for editing multiple entries at a time)
#
评论列表
文章目录