Draw a US exchange from NANPA's assignable codes, and strip every imported cell

This commit is contained in:
2026-10-04 17:33:16 +02:00
committed by Lillem4n
parent 7ac8442bcf
commit 563237a45a
5 changed files with 40 additions and 6 deletions
+2 -2
View File
@@ -5,10 +5,10 @@ from pathlib import Path
def write(path, columns, rows):
"""Write the rows as a TSV; the table needs two rows, and every cell must be non-empty and free of tabs, newlines and braces."""
"""Write the rows as a TSV; the table needs two rows, and every cell is stripped, and must be non-empty and free of tabs, newlines and braces."""
lines = ["\t".join(columns)]
for row in rows:
cells = [str(row[c]) for c in columns]
cells = [str(row[c]).strip() for c in columns]
if not all(cells) or any(re.search(r"[\t\n{}]", c) for c in cells):
raise ValueError(f"{path}: a cell is empty or holds a tab, newline or brace: {row}")
lines.append("\t".join(cells))