Skip to the workspace
Pebellslearn by building

Python syntax & reference

Find the form you need, compare how it behaves, and open the complete explanation when you need more depth.

Python 3.10+ syntax; individual entries identify newer features. Browser exercises use the configured Python runner.

1 matching syntax entry

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 →
Complete explanation index (91 lessons indexed)

pathlib

Technical sources and review date

Original Pebells examples. Reviewed 2026-10-28.

Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.