# Working with Paths (pathlib) — Python

Source: https://www.geekswithgeeks.com/en/python/py-pathlib

> The modern, object-oriented way to handle filesystem paths.

## Path basics

`pathlib.Path` replaces manual string concatenation for paths and works the same across operating systems.

```python
from pathlib import Path

p = Path("data") / "2024" / "report.csv"
print(p)                 # data/2024/report.csv
print(p.name)             # report.csv
print(p.suffix)           # .csv
print(p.exists())         # False (unless it's really there)
```
