File size: 372 Bytes
5ea4a3b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import json
import os
from datetime import datetime

import yaml


def get_timestamp():
    return datetime.now().strftime("%Y-%m-%d %H:%M:%S")


def load_yaml(path):
    with open(path, "r") as f:
        return yaml.safe_load(f)


def save_json(data, path):
    os.makedirs(os.path.dirname(path), exist_ok=True)
    with open(path, "w") as f:
        json.dump(data, f)