Paths and resource ownership
Learn in depth →Path represents filesystem paths; a with statement gives a resource a defined cleanup boundary.
Path("data") / "input.csv"
with path.open(encoding="utf-8") as handle: ...Example
from pathlib import Path
p = Path("data") / "input.csv"
print(p.name, p.suffix)Result
input.csv .csv
Watch for: Filesystem operations require appropriate permissions. Browser files live in a virtual filesystem unless explicitly exported.
Practise this topic →