DS 1501 · Lesson 23 of 24
Instructor: CS501h 32m
Sign in to watchRead, parse, validate, and serialize structured Data Science tables and hierarchical records in CSV and JSON formats with exception safety. What you will learn: • Working with csv.reader, csv.DictReader, csv.writer, and newline='' to prevent blank rows on Windows. • Serializing and deserializing Python dicts/lists with json.dump / json.dumps and json.load / json.loads. • Guarding missing files and malformed rows gracefully with try / except FileNotFoundError and ValueError. • Updating records via read-modify-write patterns in structured pipelines. University Outline Mapping: Class 23 · CO5 · Reading: 9.2–9.4 (deitel) · Activities: Lecture, Slides, Demonstration.
Note
Outline: Class 23 | CO5 | Reading: Deitel 9.2–9.4 JSON Serialization vs File I/O Cheatsheet: json.dump(obj, f) / json.load(f) -> file objects json.dumps(obj) / json.loads(s) -> strings with open('out.csv', 'w', newline='', encoding='utf-8') as f: ... Watch Corey Schafer's CSV, JSON, and Try/Except deep dives linked in Further reading!
Same resources as in the community course — sign in to watch the lesson and track progress.
Watch the whole course.
Sign in to play every lesson, track your progress, and ask questions alongside the community.
Already signed in? Open lesson in Community