Python's pathlib Module: Taming the File System Quiz
Interactive Quiz ⋅ 9 Questions
By Joseph Peart
In this quiz, you’ll revisit how to tame the file system with Python’s pathlib module.
You’ll reinforce core pathlib concepts, including checking whether a path points to a file and instantiating Path objects. You’ll revisit joining paths with the / operator and .joinpath(), iterating over directory contents with .iterdir(), and renaming files on disk with .replace().
You’ll also check your knowledge of common file operations such as creating empty files with .touch(), writing text with .write_text(), and extracting filename components using .stem and .suffix.
The quiz contains 9 questions and there is no time limit. You’ll get 1 point for each correct answer. At the end of the quiz, you’ll receive a total score. The maximum score is 100%. Good luck!
Related Resources
Course
Using Python's pathlib Module
In this video course, you'll learn how to effectively work with file system paths in Python 3 using the pathlib module in the standard library.
Tutorial
Python's pathlib Module: Taming the File System
Python's pathlib module enables you to handle file and folder paths in a modern way. This built-in module provides intuitive semantics that work the same way on different operating systems. In this tutorial, you'll get to know pathlib and explore common tasks when interacting with paths.