Python: Reading & Writing Files

Wishlist Share

About Course

Learn to read and write files with Python safely and reliably. Open files with the with statement, choose the right mode and encoding, work with paths using pathlib, read and write CSV and JSON, and handle missing files and other errors. All examples tested in Python 3.

Examples were tested with Python 3.13. Be careful when running code that writes or deletes files; test on copies of important data first.

What Will You Learn?

  • Open, read, write and append text files with the with statement Choose file modes and always set a text encoding Work with folders and paths using pathlib Read and write CSV and JSON data and handle file errors

Course Content

Course Lessons

  • Opening files the right way
  • Reading and writing text
  • Paths and folders with pathlib
  • CSV, JSON and handling errors

Sources & Further Reading
The official guidance this course is based on.

Final Assessment

Student Ratings & Reviews

No Review Yet
No Review Yet

Want to receive push notifications for all major on-site activities?

✕