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

CSV rows and newline handling

Learn in depth →

The csv module handles quoting and delimiters so a comma inside a field remains data.

csv.DictReader(handle); csv.DictWriter(handle, fieldnames=...)

Example

import csv, io
rows = csv.DictReader(io.StringIO('name,note\nAsha,"tea, please"\n'))
print(next(rows)["note"])

Result

tea, please

Watch for: For real files use open(..., newline="", encoding="utf-8"). A split(",") is not a CSV parser.

Practise this topic →
Complete explanation index (91 lessons indexed)

CSV & the Dialects Nobody Agrees On

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.