19 lines
514 B
Python
19 lines
514 B
Python
import yaml
|
|
|
|
def load(path):
|
|
with open(path, 'r') as file:
|
|
try:
|
|
data = yaml.safe_load(file)
|
|
return data
|
|
except yaml.YAMLError as e:
|
|
print(f"Error reading YAML file {path}: {e}")
|
|
return None
|
|
|
|
def save(path, data):
|
|
with open(path, 'w') as file:
|
|
try:
|
|
yaml.dump(data, file)
|
|
return True
|
|
except yaml.YAMLError as e:
|
|
print(f"Error writing to YAML file {path}: {e}")
|
|
return None |