Skip to main content
Loading page…
Python Mastery
Chapter 10
Lesson 2 of 4
Paths Done Right with pathlib
Contents
Notes
Tutor
Note
Bridge: pathlib and tempfile Imports
Loading activity…
Previous
1 / 8
Continue
Contents
Notes
Discussion
Tutor
26 min
8 activities
0 of 8 done
In this lesson
1
Bridge: pathlib and tempfile Imports
2
Why pathlib Replaces os.path
3
Path Properties and Inspection
4
Reading, Writing, and Creating with pathlib
5
Pitfall: Don't Concatenate Paths with String +
6
Path Property Quiz
7
Practice: Rename All .txt Files to .md
8
Match pathlib Methods to Their Purpose
Objectives
Learner can construct and compose file paths using Path and the / operator
Learner can inspect path components: name, stem, suffix, parent
Learner can test existence and type with exists(), is_file(), is_dir()
Learner can read, write, and glob files using pathlib's high-level methods
Chapter 10 · Files, JSON & CSV
Reading & Writing Files
Paths Done Right with pathlib
JSON: Talking to the World
CSV & Tabular Data
Previous: Reading & Writing Files
Next: JSON: Talking to the World