Spaces:
Runtime error
Runtime error
| import yaml | |
| def save_file(filepath, content): | |
| with open(filepath, "w", encoding="utf-8") as outfile: | |
| outfile.write(content) | |
| def open_file(filepath): | |
| with open(filepath, "r", encoding="utf-8", errors="ignore") as infile: | |
| return infile.read() | |
| def save_yaml(filepath, data): | |
| with open(filepath, "w", encoding="utf-8") as file: | |
| yaml.dump(data, file, allow_unicode=True) | |
| def open_yaml(filepath): | |
| with open(filepath, "r", encoding="utf-8") as file: | |
| data = yaml.load(file, Loader=yaml.FullLoader) | |
| return data | |