
Loading…

Everything this lesson covers — Module Setup & Basics, CSV Reader (List-based), CSV Writer (List-based), CSV DictReader (Dictionary-based), CSV DictWriter (Dictionary-based) and File Opening Modes — in one visual map. Click any topic to open it, or download the full map as an image for revision.
Mind map
Click a topic to open or close it · drag to move · scroll to zoom · the download includes every topic, fully expanded
Pathlib methods: path, exists(), is_file(), is_dir(), mkdir(), rename()with open('file.csv', 'mode', newline='') as file:newline='' for CSV handlingreader = csv.reader(file)for row in reader: print(row)next(reader) to advance iteratorwriter = csv.writer(file)writer.writerow(['col1', 'col2'])writer.writerows(data)reader = csv.DictReader(file)for row in reader: print(row)marks = int(row['marks'])if marks > 90: print(row['name'], marks)writer = csv.DictWriter(file, fieldnames=fieldnames)writer.writeheader()writer.writerow({'name': 'John', 'age': 30})writer.writerows(data)Append to list, then writerows()