import tempfile
from pathlib import Path
from tinytab import Table
path = Path(tempfile.mkdtemp()) / "menu.csv"
Table({"item": ["coffee", "bagel"], "price": [3.5, 2.25]}).to_csv(path)
Table.from_csv(path)| item | price |
|---|---|
| coffee | 3.5 |
| bagel | 2.25 |
Read a table from a CSV file. All values are read as strings.
Usage
path: str | Path TableSave a table with Table.to_csv(), then read it back. CSV files don’t record types, so every value comes back as a string: