Using Python's pathlib Module
Have you struggled withfile path handling in Python? With thepathlib module, the struggle is now over! You no longer need to scratch your head over code like this:
>>>path.rsplit('\\',maxsplit=1)[0]And you don’t have to cringe at the verbosity of something like this:
>>>os.path.isfile(os.path.join(os.path.expanduser('~'),'realpython.txt'))In this video course, you’ll learn how to:
- Work withfile paths in Python
- Read andwrite files in new ways
- Manipulate paths and the underlying file system
- List files anditerate over them
Using thepathlib module, the two examples above can be rewritten using elegant, readable, and Pythonic code:
>>>path.parent>>>(pathlib.Path.home()/'realpython.txt').is_file()That’s what you’ll master in this video course!
What’s Included:
- 9 Lessons
- Video Subtitles and Full Transcripts
- 1 Downloadable Resource
- Accompanying Text-Based Tutorial
- Q&A With Python Experts: Ask a Question
- Certificate of Completion
Downloadable Resources:
Related Learning Paths:
Understanding Python File Paths
2 Lessons 3m
Working With Paths
3 Lessons 9m
Diving Deeper Into Paths
4 Lessons 12m
AboutDarren Jones
With 20 years as a teacher of music technology, Darren is keen to bring his skills to the Python table.
» More about Darren














