(path: str, rows: list[dict])
| 421 | |
| 422 | |
| 423 | def write_csv(path: str, rows: list[dict]) -> None: |
| 424 | if not path or not rows: |
| 425 | return |
| 426 | with Path(path).open("w", newline="") as f: |
| 427 | writer = csv.DictWriter(f, fieldnames=list(rows[0].keys())) |
| 428 | writer.writeheader() |
| 429 | writer.writerows(rows) |
| 430 | |
| 431 | |
| 432 | def write_jsonl(path: str, rows: list[dict]) -> None: |