def json_to_yaml(filename):
'''
This function convert json file to yaml file
:param filename: filename
:type filename: str
:return: None
'''
try:
file=open(filename+".json","r")
json_data=json.loads(file.read())
yaml_file = open(filename + ".yaml", "w")
yaml.safe_dump(json_data,yaml_file,default_flow_style=False)
file.close()
yaml_file.close()
except FileNotFoundError:
print("[Error] Bad Input File")
评论列表
文章目录