jumplander's picture
Upload 34 files
b227dc8 verified
Raw
History Blame Contribute Delete
340 Bytes
import json
from pathlib import Path
def read_jsonl(path):
with Path(path).open(encoding="utf-8") as f:
for line in f:
yield json.loads(line)
def write_jsonl(path, rows):
with Path(path).open("w", encoding="utf-8") as f:
for row in rows:
f.write(json.dumps(row, ensure_ascii=False) + "\n")