Structured Data Modules
csv
Read and write delimited tabular text, honoring quoting and dialect rules. reader() returns string fields by default; DictReader maps header names to fields. Open real CSV text files with newline="" and a suitable encoding. Do not split on commas manually or assume spreadsheet-safe output.
Formal Syntax & Structure
python syntaxpython
import csvReturn Value
module
Module namespace available through import; import is a statement, not a value-returning expression.
Working Example
Example Snippetpython
import csvfrom io import StringIOsource = StringIO('name,note\nAda,"red, blue"\n')row = next(csv.DictReader(source))print(row["name"], row["note"])