Update xmisc with yaml

This commit is contained in:
D-X-Y
2021-06-10 02:11:27 -07:00
parent aef5c7579b
commit 1a7440d2af
11 changed files with 259 additions and 76 deletions

View File

@@ -0,0 +1,13 @@
#####################################################
# Copyright (c) Xuanyi Dong [GitHub D-X-Y], 2021.06 #
#####################################################
import os
import yaml
def load_yaml(path):
if not os.path.isfile(path):
raise ValueError("{:} is not a file.".format(path))
with open(path, "r") as stream:
data = yaml.safe_load(stream)
return data