Python Basics: File System Operations

Martin Breuss
Martin Breuss 33 Lessons 1h 45m basics python

So far, you’ve written programs that get their input from one of two sources: the user or the program itself. Program output has been limited to displaying some text in IDLE’s interactive window.

These input and output strategies aren’t useful in several common scenarios, such as when:

  • The input values are unknown while writing the program.
  • The program requires more data than a user can be expected to type in by themselves.
  • Output must be shared with others after the program runs.

This is where files come in. You’ve likely been working with computer files for a long time. Even so, there are some things that programmers need to know about files that general users do not. Specifically, you’ll want to master some file system operations using the pathlib and shutil modules.

In this video course, you’ll learn how to:

  • Create files and directories
  • Iterate over the contents of a directory
  • Search for files and folders using wildcards
  • Move and delete files and folders

This video course is part of the Python Basics series, which accompanies Python Basics: A Practical Introduction to Python 3. You can also check out the other Python Basics courses.

Note that you’ll be using IDLE to interact with Python throughout this course. If you’re just getting started, then you might want to check out Python Basics: Setting Up Python before diving into this course.

What’s Included:

Downloadable Resources:

Related Learning Paths:

Introducing Files and the File System

3 Lessons 14m

About Martin Breuss

Martin Breuss Martin Breuss

Martin likes automation, goofy jokes, and snakes, all of which fit into the Python community. He enjoys learning and exploring and is up for talking about it, too. He writes and records content for Real Python and CodingNomads.

» More about Martin

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:

« Browse All Courses