File size: 264 Bytes
821babe
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
import json, os
class MemoryStore:
    def __init__(self, path):
        self.path = path
        if not os.path.exists(path): open(path, 'w').close()
    def add(self, record):
        with open(self.path, 'a') as f:
            f.write(json.dumps(record) + "\n")