Using Python’s pathlib Module
Have you struggled with file path handling in Python? With the pathlib
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 with file