Practical Recipes for Working With Files in Python

Liam Pulsifer
Liam Pulsifer 13 Lessons 1h 13m basics projects

Python has several built-in modules and functions for handling files. These functions are spread out over several modules such as os, os.path, shutil, and pathlib, to name a few. This course gathers in one place many of the functions you need to know in order to perform the most common operations on files in Python.

In this course, you’ll learn how to:

  • Retrieve file properties
  • Create directories
  • Match patterns in filenames
  • Traverse directory trees
  • Make temporary files and directories
  • Delete files and directories
  • Copy, move, or rename files and directories
  • Create and extract ZIP archives

What’s Included:

Downloadable Resources:

Related Learning Paths:

About Liam Pulsifer

Liam is a software engineer and avid Pythonista. When he's not writing code to automate all of his daily tasks, you can often find him running, playing basketball and tennis, reading, or eating good food.

» More about Liam

Each tutorial at Real Python is created by a team of developers so that it meets our high quality standards. The team members who worked on this tutorial are:

Participant Comments

Avatar image for jillwellman

jillwellman on May 4, 2022

Excellent course. Complete. Efficiently presented. I love having the video to go through for an overview. Will return and work through the examples semi-independently to get the skills I need right now. Thank you for your work!

Avatar image for Robert T

Robert T on Sept. 30, 2021

Great course, Liam, I learned a lot and this will help me in the future!

Avatar image for agerbes

agerbes on Aug. 9, 2020

Awesome Tutorial. Good Job!

Avatar image for Hilman

Hilman on Aug. 9, 2020

Beautiful, easy-to-understand series. Thank you.

Avatar image for Robb Glietz

Robb Glietz on Aug. 4, 2020

Great video learned a ton about how files work in Python. Thank you.

← Browse All Courses