cookies-icon

Our website uses cookies. By using this website, you agree to their use in accordance with the browser settings. You can modify your browser settings on your own. For more information see our Privacy Policy.

Course

Basic

Working with Files and Directories in Python

Would you like to learn how to work with files and directories in Python? Check out this interactive course!

Table of contents

Lifetime access

B042DDD8-A1C9-4053-8AF3-463EB31543B8@2x

limited to this course only

$29

Buy now

Want a better deal?

B042DDD8-A1C9-4053-8AF3-463EB31543B8@2x

Get unlimited lifetime access to all 13 present and future courses

Save $250

Unlimited lifetime access

B042DDD8-A1C9-4053-8AF3-463EB31543B8@2x

to all 13 present and future courses

$ 99

$ 349

72% OFF

Buy now Full pricing
104

Interactive exercises

10 h

Estimated time

248

Users enrolled

☆☆☆☆☆
★★★★★

2 ratings

Do you deal with files and directories daily? Do you want to load data into the program more efficiently, store the results, and easily share them with others? We have something for you! Take this interactive course to learn how to work with files and directories in Python.

We have created this Python course primarily for people who are just starting their adventure with programming. However, this does not mean that more advanced users will not find something for themselves. This is a complete course on how to work with files and directories in Python.

In the first section, you’ll learn the basics of working with files: how to open and close files and the modes for working with files in Python. In particular, you’ll learn how to use the with syntax, the most convenient way to work with files in Python.

You’ll also learn different ways to read files into Python: with read(), with readline() or readlines(), and with a for loop. In addition, you’ll learn how to handle exceptions when working with files.

In the next sections, you’ll learn how to work with directories and how to manage files in Python. Soon you’ll create directories, remove and rename files and directories, and list the contents of a directory with ease.

You’ll also learn to find file attributes such as the date of modification or the date of access. In addition, you’ll learn how to work with file paths and file names.

In the last section, you’ll discover the power of the pathlib module. The modern pathlib module offers an easier and more intuitive way to work with files and directories in Python. Finally, a quiz will help you consolidate and verify your newly acquired knowledge.

In this interactive course, you’ll write real Python programs to solve the exercises. Our web-based platform will run your commands and verify your solutions. You don’t need to install anything on your computer.

To take this course, it’s best to have learned the basics of Python syntax from our Python Basics series (Python Basics. Part 1, Python Basics. Part 2, and Python Basics. Part 3) or have the equivalent knowledge. You should already know about variables, if statements, for and while loops, and how to create functions in Python.

You might already have some basic knowledge of how to work with files, but it’s not a requirement. We’ll review all you need to know on the topic in the course.

What's in It for Me?

  • 104 interactive exercises to practice your programming skills: solve them at your own pace, from anywhere and at any time, interacting with hands-on exercises for improved retention
  • Lifetime access to the course: when you purchase the course, you'll get instant personal access to all of its content
  • Certificate of completion: after you successfully finish all of the exercises, you'll get a downloadable PDF certificate to showcase your accomplishment
  • 30-day, money-back guarantee: if you're not satisfied with the quality of the course, you can get a refund within 30 days of your purchase
  • Hints for the exercises: you can ask questions and share insights with other members of the community through the Discuss tab (we'll be more than happy to answer! 😉)

What Are the Requirements?

What Will I Learn in This Course?

  • You’ll learn about the functions open() and close(), which allow you to open and close files in Python.
  • You’ll learn about different modes for working with files in Python: reading (r mode), writing (w mode), appending (a mode), and others.
  • You’ll practice the with syntax, the most common and convenient syntax for working with files in Python.
  • You’ll learn how to handle exceptions that arise when working with files in Python.
  • You’ll learn about various functions for reading data from files in Python: read(), readline(), readlines(), and looping over text files with a for loop.
  • You’ll learn about various functions for writing data to a file in Python: write() and writelines().
  • You’ll learn how to work with directories in Python: how to create directories, how to remove or rename directories, and how to list the contents of a directory.
  • You’ll learn how to manage files in Python: how to move or rename files and how to find out the modification date or file permissions.
  • In addition to the traditional Python file API in os and os.path modules, you’ll learn the modern Python file API in the pathlib module.

Who Should Take This Course?

  • Students taking programming classes who want to review and practice their skills related to working with files in Python
  • Data Analysts who need to work with various files in Python
  • Aspiring Python programmers who want to learn or review their knowledge in working with files in Python
  • Hobbyists looking for exercises on how to work with files in Python

Table of contents

Free

Paid content

0%

Course progress

0/104

Exercises completed

1.

Introduction

Learn basic information about paths, files, and directories

0/6
Start now

Reviews (0)

Average rating

4.50 / 5

☆☆☆☆☆
★★★★★

2 ratings

Details

5 stars

50%

4 stars

50%

3 stars

0%

2 stars

0%

1 stars

0%